結果

問題 No.117 組み合わせの数
ユーザー testestesttestestest
提出日時 2016-12-05 12:09:48
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 246 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 21,888 KB
実行使用メモリ 17,152 KB
最終ジャッジ日時 2024-05-05 20:17:38
合計ジャッジ時間 738 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
    2 | P=1e9+7,x,c,r;
      | ^
main.c:2:1: warning: type defaults to ‘int’ in declaration of ‘P’ [-Wimplicit-int]
main.c:2:9: warning: type defaults to ‘int’ in declaration of ‘x’ [-Wimplicit-int]
    2 | P=1e9+7,x,c,r;
      |         ^
main.c:2:11: warning: type defaults to ‘int’ in declaration of ‘c’ [-Wimplicit-int]
    2 | P=1e9+7,x,c,r;
      |           ^
main.c:2:13: warning: type defaults to ‘int’ in declaration of ‘r’ [-Wimplicit-int]
    2 | P=1e9+7,x,c,r;
      |             ^
main.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    3 | p(long a,int i){x=i?p(a*a%P,i/2)*(i%2?a:1)%P:1;}
      | ^
main.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    4 | main(n){
      | ^~~~
main.c: In function ‘main’:
main.c:4:1: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int]
main.c:5:13: warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration]
    5 |         for(gets(f),*f=n;r++<2e6;f[r]=f[r-1]*r%P);
      |             ^~~~
main.c:6:17: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    6 |         for(;x=~scanf(" %c(%d,%d)",&c,&n,&r);printf("%d\n",n<r?0:f[n]*p(f[n-r]*(c%5?f[r]:1)%P,P-2)%P))c&8&&(n+=r)&&n--;
      |                 ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | long f[1<<21];
main.c:6:17: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    6 |         for(;x=~scanf(" %c(%d,%d)",&c,&n,&r);printf("%d\n",n<r?0:f[n]*p(f[n-r]*(c%5?f[r]:1)%P,P-2)%P))c&8&&(n+=r)&&n--;
      |                 ^~~~~
main.c:6:17: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:6:26: warning: format ‘%c’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wfor

ソースコード

diff #

long f[1<<21];
P=1e9+7,x,c,r;
p(long a,int i){x=i?p(a*a%P,i/2)*(i%2?a:1)%P:1;}
main(n){
	for(gets(f),*f=n;r++<2e6;f[r]=f[r-1]*r%P);
	for(;x=~scanf(" %c(%d,%d)",&c,&n,&r);printf("%d\n",n<r?0:f[n]*p(f[n-r]*(c%5?f[r]:1)%P,P-2)%P))c&8&&(n+=r)&&n--;
}
0