超时求助
查看原帖
超时求助
989399
louzezhong20130517楼主2023/8/13 10:41
#include<bits/stdc++.h>
using namespace std;
long long fb(int n)
{
	double t=sqrt(5),f;
	double a=(1+t)/2,b=(1-t)/2;
	f=(pow(a,n)-pow(b,n))/t;
	return f;
}
void f(int n)
{
	int i=2;
	cout<<n<<"=";
	do{
		while(n%i==0)
		{
			cout<<i;
			n/=i;
			if(n!=1)
			{
				cout<<"*";
			}
		}
		i++;
	}
	while(n!=1);
}
int main(){
	long long n;
	cin>>n;
	f(fb(n));
	return 0;
}
2023/8/13 10:41
加载中...