求助:样例过,测试点信息过,但全RE
查看原帖
求助:样例过,测试点信息过,但全RE
1271387
Drama_zhao001楼主2024/8/11 20:39

本蒟蒻代码:

#include<bits/stdc++.h>
using namespace std;
const long long Mod=pow(2,31);
int n;
int a[60],s;
long long fx(int x){
	if(x>n) return a[n-1]+a[n-2];
	a[x]=(a[x-1]+a[x-2])%Mod;
	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/11 20:39
加载中...