結果
| 問題 |
No.8038 フィボナッチ数列の周期
|
| コンテスト | |
| ユーザー |
👑 testestest
|
| 提出日時 | 2018-01-26 07:33:19 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 643 bytes |
| コンパイル時間 | 130 ms |
| コンパイル使用メモリ | 30,592 KB |
| 実行使用メモリ | 14,016 KB |
| 最終ジャッジ日時 | 2024-06-25 06:47:18 |
| 合計ジャッジ時間 | 6,626 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 TLE * 1 -- * 8 |
コンパイルメッセージ
main.c:8:1: warning: return type defaults to 'int' [-Wimplicit-int]
8 | main(){
| ^~~~
main.c: In function 'main':
main.c:11:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
11 | scanf("%d",&n);
| ^~~~~
main.c:1:1: note: 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: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
11 | scanf("%d",&n);
| ^~~~~
main.c:11:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:33:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
33 | printf("%d\n",ans);
| ^~~~~~
main.c:33:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:33:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:33:9: note: include '<stdio.h>' or provide a declaration of 'printf'
ソースコード
#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);
}
testestest