結果

問題 No.243 出席番号(2)
ユーザー testestesttestestest
提出日時 2017-11-09 01:43:05
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 269 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 30,464 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-03 07:56:14
合計ジャッジ時間 3,130 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 0 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 1 ms
6,944 KB
testcase_29 AC 1 ms
6,940 KB
testcase_30 AC 1 ms
6,940 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | P=1e9+7;
      | ^
main.c:1:1: warning: type defaults to 'int' in declaration of 'P' [-Wimplicit-int]
main.c:2:1: warning: data definition has no type or storage class
    2 | a[6000],n,t,f,ans,i,k;
      | ^
main.c:2:1: warning: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:2:9: warning: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
    2 | a[6000],n,t,f,ans,i,k;
      |         ^
main.c:2:11: warning: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
    2 | a[6000],n,t,f,ans,i,k;
      |           ^
main.c:2:13: warning: type defaults to 'int' in declaration of 'f' [-Wimplicit-int]
    2 | a[6000],n,t,f,ans,i,k;
      |             ^
main.c:2:15: warning: type defaults to 'int' in declaration of 'ans' [-Wimplicit-int]
    2 | a[6000],n,t,f,ans,i,k;
      |               ^~~
main.c:2:19: warning: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
    2 | a[6000],n,t,f,ans,i,k;
      |                   ^
main.c:2:21: warning: type defaults to 'int' in declaration of 'k' [-Wimplicit-int]
    2 | a[6000],n,t,f,ans,i,k;
      |                     ^
main.c:4:1: warning: return type defaults to 'int' [-Wimplicit-int]
    4 | main(){
      | ^~~~
main.c: In function 'main':
main.c:5:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    5 |         scanf("%d",&n);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | P=1e9+7;
main.c:5:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    5 |         scanf("%d",&n);
      |         ^~~~~
main.c:5:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:10:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   10 |         printf("%d",(ans+P)%P);
      |         ^~~~~~

ソースコード

diff #

P=1e9+7;
a[6000],n,t,f,ans,i,k;
long dp[6000];
main(){
	scanf("%d",&n);
	for(;~scanf("%d",&t);)a[t]++;
	f=dp[0]=1;
	for(k=0;k<n;k++)for(i=k;i>=0;i--)dp[i+1]=(dp[i+1]+dp[i]*a[k])%P;
	for(i=0;i<=n;f=(f*++i)%P)ans=(ans+(n-i&1?-1:1)*f*dp[n-i])%P;
	printf("%d",(ans+P)%P);
}
0