結果

問題 No.3038 フィボナッチ数列の周期
ユーザー testestesttestestest
提出日時 2018-01-26 07:33:19
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 643 bytes
コンパイル時間 1,042 ms
コンパイル使用メモリ 29,192 KB
実行使用メモリ 6,016 KB
最終ジャッジ日時 2023-09-07 12:42:56
合計ジャッジ時間 7,017 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
4,376 KB
testcase_01 AC 17 ms
4,376 KB
testcase_02 AC 9 ms
4,380 KB
testcase_03 AC 9 ms
4,380 KB
testcase_04 AC 9 ms
4,380 KB
testcase_05 AC 9 ms
4,376 KB
testcase_06 AC 435 ms
4,376 KB
testcase_07 AC 107 ms
4,380 KB
testcase_08 AC 99 ms
4,376 KB
testcase_09 AC 66 ms
4,376 KB
testcase_10 AC 173 ms
4,384 KB
testcase_11 AC 61 ms
4,380 KB
testcase_12 AC 139 ms
4,376 KB
testcase_13 AC 117 ms
4,376 KB
testcase_14 AC 152 ms
4,376 KB
testcase_15 AC 449 ms
4,376 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:8:1: 警告: 戻り値の型をデフォルトの ‘int’ にします [-Wimplicit-int]
    8 | main(){
      | ^~~~
main.c: 関数 ‘main’ 内:
main.c:11:9: 警告: 関数 ‘scanf’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   11 |         scanf("%d",&n);
      |         ^~~~~
main.c:1:1: 備考: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | #define max(p,q)((p)>(q)?(p):(q))
main.c:11:9: 警告: 組み込み関数 ‘scanf’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
   11 |         scanf("%d",&n);
      |         ^~~~~
main.c:11:9: 備考: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:33:9: 警告: 関数 ‘printf’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   33 |         printf("%d\n",ans);
      |         ^~~~~~
main.c:33:9: 備考: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:33:9: 警告: 組み込み関数 ‘printf’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
main.c:33:9: 備考: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #

#define max(p,q)((p)>(q)?(p):(q))
#define ll long long
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}

#define M 1000000007
#define N 10000000
int pp[N+10];
main(){
	//med解法
	int n;
	scanf("%d",&n);
	while(n--){
		int p,k,m=1;
		scanf("%d%d",&p,&k);
		while(k--)m*=p;
		int a=1,b=1,cnt=1;
		while(a!=0||b!=1){
			int t=a+b;
			a=b;b=t%m;cnt++;
		}
		for(int i=2;i*i<=cnt;i++)if(cnt%i==0){
			int cc=0;
			while(cnt%i==0){
				cnt/=i;
				cc++;
			}
			pp[i]=max(pp[i],cc);
		}
		if(cnt!=1)pp[cnt]=max(pp[cnt],1);
	}
	int ans=1;
	for(int i=2;i<N;i++)if(pp[i])ans=ans*pom(i,pp[i],M)%M;
	printf("%d\n",ans);
}
0