要取模的
by I_AK_Ynoi @ 2022-11-23 13:43:10
@[2011Andy](/user/660871) 每次算完要 `a[i]%=(1ll<<31ll)`,同时开 `long long`
by I_AK_Ynoi @ 2022-11-23 13:44:50
```cpp
#include<bits/stdc++.h>
using namespace std;
int n , a[55] , s;
int main(){
cin >> n;
a[1] = 1;
a[2] = 1;
for(int i = 3 ; i <= n ; i++){
a[i] = a[i - 1] + a[i - 2];
}
cout << a[n] << "=";
s = a[n];
for(int i = 2 ; i <= s ; i++){
while(s % i == 0) { // 像8=2^3一样,一个质因数也能有多次幂
cout << i;
s /= i;
if(s != 1){
cout << "*";
}
i = 1;
}
}
return 0;
}
```
by ___njr___ @ 2022-11-23 19:15:18
边算边取模 不然就开long long了
by cxzhyf @ 2023-04-24 19:38:15
long long 一定要开@[2011Andy](/user/660871)
by cxzhyf @ 2023-04-25 13:23:45
没想到这么久还有人来看,QAQ
by 2011Andy @ 2023-04-25 13:36:54