60TLE,救救我
查看原帖
60TLE,救救我
1095813
herobring_楼主2025/1/19 16:00
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll a,n,m,x,s[100001],xia[100001],c[100001];
int main()
{
	cin>>a>>n>>m>>x;
	s[1]=a;
	for(int i=1;;i++)
	{
	 s[2]=i;
	 xia[2]=i;
	 c[2]=a;
	 for(int j=3;j<=n-1;j++)
	 {
	  s[j]=s[j-1]+s[j-2];
	  xia[j]=s[j-1];
	  c[j]=c[j-1]+s[j]-xia[j];
	 }
	 xia[n]=c[n-1];
	 if(xia[n]==m)
	 {
	  cout<<c[x];
	  return 0;
	 }
	}
	return 0;
}
2025/1/19 16:00
加载中...