40分求助,实在没找到问题

P1011 [NOIP1998 提高组] 车站

这是我的代码你借鉴一下 ```cpp #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; } ``` @[wang6w6](/user/1051310)
by _Daniel_ @ 2024-07-06 09:45:44


@[_Daniel_](/user/954175) 感谢
by wang6w6 @ 2024-07-06 09:57:00


@[wang6w6](/user/1051310) [我的代码](https://www.luogu.com.cn/discuss/849189)在DEV-CPP里第二个测试点是通过的,但到了洛谷就过不去
by VictorMao @ 2024-07-10 21:15:39


|