###蒟蒻求助
查看原帖
###蒟蒻求助
723517
Joseph__Joestar楼主2022/6/19 12:29
#include<cstdio>
using namespace std;
int cnt;
int solve(int m)
{
	long long a=0,b=1,t;
	do{
		t=b;
	    b=a+b;
	    a=t;
	  	++cnt;
	  }while(a%m!=0||b%m!=1);
	return cnt;  
}
int main()
{
	int m;
	scanf("%d",&m);
	printf("%d",solve(m));
	return 0;
}

只过了1,2,3,5。

2022/6/19 12:29
加载中...