Run ID:161008

提交时间:2026-09-27 09:46:05

#include<bits/stdc++.h> using namespace std; int main(){ int a,n,m,x,sc[16]={},xc[16]={},r[16]={}; cin>>a>>n>>m>>x; sc[1]=r[1]=r[2]=a; xc[1]=0; for(int i=0;i<m;i++){ sc[2]=xc[2]=i; for(int j=3;j<n;j++){ sc[j]=sc[j-1]+sc[j-2]; xc[j]=sc[j-1]; r[j]=r[j-1]+sc[j-2]; } if(r[n-1]==m){ cout<<r[x]<<endl; return 0; } } cout<<"No answer."<<endl; return 0; }