結果
問題 | No.109 N! mod M |
ユーザー | 👑 hos.lyric |
提出日時 | 2015-02-17 22:23:34 |
言語 | C90 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 94 ms / 5,000 ms |
コード長 | 244 bytes |
コンパイル時間 | 869 ms |
コンパイル使用メモリ | 25,008 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-04 05:23:36 |
合計ジャッジ時間 | 1,248 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 12 ms
4,376 KB |
testcase_02 | AC | 14 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 94 ms
4,376 KB |
testcase_06 | AC | 7 ms
4,376 KB |
testcase_07 | AC | 10 ms
4,384 KB |
testcase_08 | AC | 1 ms
4,380 KB |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class n,m,d;long long a,b;main(t){for(scanf("%d",&t);t--;a=0){scanf("%d%d",&n,&m);for(d=1;d*++d<=m;)if(m%d<1){if(n<d+m/d)for(a=1;n;)a=a*n--%m;goto l;}if(n<m){for(b=1;++n<m;)b=b*n%m;for(a=m-1,n-=2;n;n/=2,b=b*b%m)if(n&1)a=a*b%m;}l:printf("%lld\n",a);}} ^ main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘n’ [-Wimplicit-int] main.c:1:3: warning: type defaults to ‘int’ in declaration of ‘m’ [-Wimplicit-int] n,m,d;long long a,b;main(t){for(scanf("%d",&t);t--;a=0){scanf("%d%d",&n,&m);for(d=1;d*++d<=m;)if(m%d<1){if(n<d+m/d)for(a=1;n;)a=a*n--%m;goto l;}if(n<m){for(b=1;++n<m;)b=b*n%m;for(a=m-1,n-=2;n;n/=2,b=b*b%m)if(n&1)a=a*b%m;}l:printf("%lld\n",a);}} ^ main.c:1:5: warning: type defaults to ‘int’ in declaration of ‘d’ [-Wimplicit-int] n,m,d;long long a,b;main(t){for(scanf("%d",&t);t--;a=0){scanf("%d%d",&n,&m);for(d=1;d*++d<=m;)if(m%d<1){if(n<d+m/d)for(a=1;n;)a=a*n--%m;goto l;}if(n<m){for(b=1;++n<m;)b=b*n%m;for(a=m-1,n-=2;n;n/=2,b=b*b%m)if(n&1)a=a*b%m;}l:printf("%lld\n",a);}} ^ main.c:1:21: warning: return type defaults to ‘int’ [-Wimplicit-int] n,m,d;long long a,b;main(t){for(scanf("%d",&t);t--;a=0){scanf("%d%d",&n,&m);for(d=1;d*++d<=m;)if(m%d<1){if(n<d+m/d)for(a=1;n;)a=a*n--%m;goto l;}if(n<m){for(b=1;++n<m;)b=b*n%m;for(a=m-1,n-=2;n;n/=2,b=b*b%m)if(n&1)a=a*b%m;}l:printf("%lld\n",a);}} ^~~~ main.c: In function ‘main’: main.c:1:21: warning: type of ‘t’ defaults to ‘int’ [-Wimplicit-int] main.c:1:33: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] n,m,d;long long a,b;main(t){for(scanf("%d",&t);t--;a=0){scanf("%d%d",&n,&m);for(d=1;d*++d<=m;)if(m%d<1){if(n<d+m/d)for(a=1;n;)a=a*n--%m;goto l;}if(n<m){for(b=1;++n<m;)b=b*n%m;for(a=m-1,n-=2;n;n/=2,b=b*b%m)if(n&1)a=a*b%m;}l:printf("%lld\n",a);}} ^~~~~ main.c:1:33: warning: incompatible implicit declaration of built-in
ソースコード
n,m,d;long long a,b;main(t){for(scanf("%d",&t);t--;a=0){scanf("%d%d",&n,&m);for(d=1;d*++d<=m;)if(m%d<1){if(n<d+m/d)for(a=1;n;)a=a*n--%m;goto l;}if(n<m){for(b=1;++n<m;)b=b*n%m;for(a=m-1,n-=2;n;n/=2,b=b*b%m)if(n&1)a=a*b%m;}l:printf("%lld\n",a);}}