結果
問題 | No.117 組み合わせの数 |
ユーザー | testestest |
提出日時 | 2016-12-05 11:58:59 |
言語 | C90 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 162 ms / 5,000 ms |
コード長 | 328 bytes |
コンパイル時間 | 124 ms |
コンパイル使用メモリ | 21,760 KB |
実行使用メモリ | 17,024 KB |
最終ジャッジ日時 | 2024-05-05 20:17:30 |
合計ジャッジ時間 | 838 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
コンパイルメッセージ
main.c: In function ‘main’: main.c:6:9: warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration] 6 | gets(f); | ^~~~ main.c:8:17: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 8 | for(;i=~scanf(" %c(%d,%d)",&c,&n,&r);){ | ^~~~~ main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ +++ |+#include <stdio.h> 1 | #define long long long main.c:8:17: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch] 8 | for(;i=~scanf(" %c(%d,%d)",&c,&n,&r);){ | ^~~~~ main.c:8:17: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:8:26: warning: format ‘%c’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wformat=] 8 | for(;i=~scanf(" %c(%d,%d)",&c,&n,&r);){ | ~^ ~~ | | | | char * int * | %lc main.c:10:17: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] 10 | printf("%d\n",n<r?0:f[n]*p(f[n-r]*(c%5?f[r]:1)%P,P-2)%P); | ^~~~~~ main.c:10:17: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ main.c:10:17: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch] main.c:10:17: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ main.c:10:26: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=] 10 | printf("%d\n",n<r?0:f[n]*p(f[n-r]*(c%5?f[r]:1)%P,P-2)%P); | ~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | |
ソースコード
#define long long long long f[1<<21]; int P=1e9+7,i,c,r,n=1; int p(long a,int i){return i?p(a*a%P,i/2)*(i%2?a:1)%P:1;} int main(){ gets(f); for(*f=n;r++<2e6;f[r]=f[r-1]*r%P); for(;i=~scanf(" %c(%d,%d)",&c,&n,&r);){ c&8&&(n+=r)&&n--; printf("%d\n",n<r?0:f[n]*p(f[n-r]*(c%5?f[r]:1)%P,P-2)%P); } return 0; } //キレそう