48分通项公式求改
查看原帖
48分通项公式求改
1001542
K_func楼主2024/10/18 17:42
#include <bits/stdc++.h>
#define s5 sqrt(5)
using namespace std;
int n,m;
long long gcd(int a,int b){
	if(b==0){
		return a;
	}
	return gcd(b,a%b);
}
int main(){
	cin>>n>>m;
	cout<<1/s5*(pow((s5+1)/2,gcd(n,m))-pow((s5-1)/2,gcd(n,m)));
	return 0;
}
2024/10/18 17:42
加载中...