暴力50分,求助大佬┭┮﹏┭┮呜呜呜
查看原帖
暴力50分,求助大佬┭┮﹏┭┮呜呜呜
104775
zinuo楼主2020/8/14 17:16
#include<iostream>
using namespace std;
long long s[100000],o[100000],f[100000];
int main(){
   long long a,n,m,x,i,j;
   cin>>a>>n>>m>>x;
   f[1]=a,f[2]=a,s[1]=a,o[1]=a;
   for(i=0;;i++){
   	s[2]=i,o[2]=a;
   	for(j=3;j<n;j++){
   		s[j]=s[j-1]+s[j-2];
   		o[j]=s[j-1];
   		f[j]=f[j-1]+s[j]-o[j-1];
   	}
   	if(f[n-1]==m){
   		cout<<f[x];
   		return 0;
   	}
   }
} 
2020/8/14 17:16
加载中...