P1011 [NOIP1998 提高组] 车站

小学奥数题解法?找通项公式 ``` #include<bits/stdc++.h> using namespace std; const int N=1e2; int a,n,m,x; int tmp; int f[N],h[N]; int main(){ cin>>a>>n>>m>>x; n-=1; h[1]=1; h[2]=1; for(int i=3;i<=n;i++){ h[i]=h[i-1]+h[i-2]; } tmp=(m-(h[n-2]+1)*a)/(h[n-1]-1); cout<<(h[x-2]+1)*a+h[x-1]*tmp-tmp; return 0; } ```
by queenbee @ 2024-03-22 16:27:33


其实还比较好推,就是很费时间
by queenbee @ 2024-03-22 16:28:31


|