結果

問題 No.117 組み合わせの数
コンテスト
ユーザー ciel
提出日時 2015-06-20 03:29:25
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 376 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 135 ms
コンパイル使用メモリ 30,152 KB
最終ジャッジ日時 2026-02-23 18:34:07
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:3:26: warning: data definition has no type or storage class
    3 | long long I[L],F[L],R[L];C,i,T,N,K;main(){
      |                          ^
main.c: In function ‘main’:
main.c:6:13: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    6 |         for(scanf("%d",&T);T--;)if(scanf("\n%c(%d,%d)",&C,&N,&K),C-80)printf("%lld\n",N==-1&&K==0?1:N<K?0:(__int128_t)F[N]*R[K]*R[N-K]%M,N=C-67?N+K-1:N);else printf("%lld\n",N<K?0:F[N]*R[N-K]%M);
      |             ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | #define L 2000000
main.c:6:46: warning: format ‘%c’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wformat=]
    6 |         for(scanf("%d",&T);T--;)if(scanf("\n%c(%d,%d)",&C,&N,&K),C-80)printf("%lld\n",N==-1&&K==0?1:N<K?0:(__int128_t)F[N]*R[K]*R[N-K]%M,N=C-67?N+K-1:N);else printf("%lld\n",N<K?0:F[N]*R[N-K]%M);
      |                                             ~^         ~~
      |                                              |         |
      |                                              char *    int *
      |                                             %lc
main.c:6:71: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
    6 |         for(scanf("%d",&T);T--;)if(scanf("\n%c(%d,%d)",&C,&N,&K),C-80)printf("%lld\n",N==-1&&K==0?1:N<K?0:(__int128_t)F[N]*R[K]*R[N-K]%M,N=C-67?N+K-1:N);else printf("%lld\n",N<K?0:F[N]*R[N-K]%M);
      |                                                                       ^~~~~~
main.c:6:71: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:6:82: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘__int128’ [-Wformat=]
    6 |         for(scanf("%d",&T);T--;)if(scanf("\n%c(%d,%d)",&C,&N,&K),C-80)printf("%lld\n",N==-1&&K==0?1:N<

ソースコード

diff #
raw source code

#define L 2000000
#define M 1000000007
long long I[L],F[L],R[L];C,i,T,N,K;main(){
	for(;i<1;i++)I[i]=F[i]=R[i]=1;
	for(;i<L;i++)I[i]=(M-M/i)*I[M%i]%M,F[i]=i*F[i-1]%M,R[i]=I[i]*R[i-1]%M;
	for(scanf("%d",&T);T--;)if(scanf("\n%c(%d,%d)",&C,&N,&K),C-80)printf("%lld\n",N==-1&&K==0?1:N<K?0:(__int128_t)F[N]*R[K]*R[N-K]%M,N=C-67?N+K-1:N);else printf("%lld\n",N<K?0:F[N]*R[N-K]%M);
}
0