2个tle,why?
查看原帖
2个tle,why?
1073167
HuangZihan181楼主2024/4/5 10:42
//https://www.luogu.com.cn/problem/P2626
#include<bits/stdc++.h>
using namespace std;
int f(int n){
	if(n==1||n==2){
		return 1;
	}
	return f(n-1)+f(n-2);
}
int main() {
	int n,x;
	cin>>n;
	int k=f(n);
	cout<<k<<"=";
	for(int i=2;i<=k;i++){
		while(k%i==0){
			x++;
			if(x==1){
				cout<<i;
			}
			else{
				cout<<"*"<<i;
			}
			k/=i;
		}
	}
	return 0;
}
2024/4/5 10:42
加载中...