悬赏两个关注
查看原帖
悬赏两个关注
1271387
Drama_zhao001楼主2024/8/18 17:33

全RE,但测试点全过,求大佬

#include<bits/stdc++.h>
using namespace std;
const long long mod=pow(2,31);
int n;
long long a[100],s;
long long fx(int x){
	if(x>n) return a[n-1]+a[n-2];
	a[x]=a[x-1]+a[x-2];
	fx(x+1); 
}
bool su(int x){
	int i=2;
	while(i<=sqrt(x)&&x%i!=0){
		i++;
	}
	return i>sqrt(x);//true 素数;   false合数 
}
int main(){
	cin>>n;
	a[1]=1;
	a[2]=1;
	s=fx(3)%mod;
	cout<<s<<"=";
	int i=2;
	while(i<=s){
		if(s%i==0&&su(i)){
			cout<<i;
			s/=i;
			i=2;
			if(s!=1) cout<<"*";
		}
		else i++;
	}
	return 0;
}
2024/8/18 17:33
加载中...