80分,最后两个点RE了TAT

P4994 终于结束的起点

貌似数组开小了。
by KAqwq @ 2023-08-21 10:21:06


@[KAqwq](/user/448018) OK,谢谢,我改一下
by IKUN_LMX @ 2023-08-21 10:22:23


@[KAqwq](/user/448018) 开小了就re,开大了就超时TAT
by IKUN_LMX @ 2023-08-21 10:25:00


```cpp #include<bits/stdc++.h> using namespace std; const int N=1e7; int sum[N]; int main(){ sum[0]=0; sum[1]=1; long long n; long long m; cin>>m; for(int i=2;i<1e7 ;i++){ sum[i]=(sum[i-1]+sum[i-2])%m; } for(int i=1;i>0;i++){ if(sum[i]%m==0&&sum[i+1]%m==1){ cout<<i<<endl; return 0; } } } ``` @[IKUN_LMX](/user/947040) 改成这样就好了
by Ar_cher @ 2023-08-21 10:31:05


@[YoudaFarmer](/user/471767) 谢谢谢谢
by IKUN_LMX @ 2023-08-21 10:31:47


``` #include<bits/stdc++.h> using namespace std; long long a[10000000]; long long m; int main(){ ios::sync_with_stdio(false); cin>>m; a[0]=0; a[1]=1; for(int i=2;i<=m*m;i++){ a[i]=(a[i-1]+a[i-2])%m; if(a[i]==1&&a[i-1]==0){ cout<<i-1<<endl; return 0; } } return 0; } ```
by unhappysheep @ 2023-08-21 10:38:27


感谢大家,已经AC,谢谢
by IKUN_LMX @ 2023-08-21 10:38:52


|