捉
by canwen @ 2024-06-08 16:01:03
刚刚AC的
```cpp
#include<iostream>
#include<cmath>
using namespace std;
#define ll long long
int x=0;
void dfs(ll a,ll b){
if(a==1) return;
if(a%b==0){
if(x==0) cout<<b;
else cout<<"*"<<b;
x++;
dfs(a/b,b);
}else{
dfs(a,b+1);
}
}
ll shuzu[50];
int main(){
shuzu[1]=1;
shuzu[2]=1;
int n;cin>>n;
for(int i=3;i<=n;i++){
shuzu[i] = (shuzu[i-1]+shuzu[i-2])%(ll)pow(2,31);
}
cout<<shuzu[n]<<"=";
dfs(shuzu[n],2);
return 0;
}
```
by canwen @ 2024-06-08 16:10:22
没有看清题目,需要对于斐波那契数列去模 $2^{31}$
by smll_wlm @ 2024-06-08 16:19:07
```cpp
#include<bits/stdc++.h>
using namespace std;
long long fb(long long n){
long long a=1,b=1,c=2;
if(n==1)return 1;
else if(n==2)return 1;
else{
for(int i=0;i<n-2;i++){
c=a+b;
a=b;
b=c;
}
return c;
}
}
int main(){
int x;
cin>>x;
long long t=fb(x)%(long long)pow(2,31);
cout<<t<<'=';
int i=2;
while(i<t){
if(t%i==0){
cout<<i<<"*";
t/=i;
}
else i++;
}
cout<<t;
return 0;
}
```
by csxx601cjy @ 2024-06-08 17:04:54
@[csxx601cjy](/user/1283951) @[smll_wlm](/user/748520) @[canwen2](/user/1284815)
AC了,十分感谢!!!!
by luoyebushiye @ 2024-06-08 18:11:13