这题不完全是斐波那契数列啊,不然 $n,m$ 有什么用
by SlaineTroyard @ 2022-10-12 21:37:27
@[zhizhi_c](/user/768144)
by SlaineTroyard @ 2022-10-12 21:37:36
建议查看此题解:[https://www.luogu.com.cn/blog/dingcx-juruo/solution-p1011](https://www.luogu.com.cn/blog/dingcx-juruo/solution-p1011)
by SlaineTroyard @ 2022-10-12 21:39:31
@[zhizhi_c](/user/768144)
求关注
~~看啥题解~~
```
#include<iostream>
using namespace std;
int ta[21],tb[21];
int main()
{
int a,n,m,x;
cin>>a>>n>>m>>x;
ta[1]=1;ta[2]=1;ta[3]=2;
for(int i=4;i<n;i++)
{
ta[i]=ta[i-1]+ta[i-2]-1;
tb[i]=tb[i-1]+tb[i-2]+1;
}
int b=(m-a*ta[n-1])/tb[n-1];
cout<<ta[x]*a+tb[x]*b<<endl;
return 0;
}
by xxc123 @ 2023-04-11 21:45:18