結果
問題 | No.10 +か×か |
ユーザー | %20 |
提出日時 | 2017-07-10 22:54:04 |
言語 | C (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 381 bytes |
コンパイル時間 | 643 ms |
コンパイル使用メモリ | 29,056 KB |
実行使用メモリ | 33,664 KB |
最終ジャッジ日時 | 2024-10-07 07:16:50 |
合計ジャッジ時間 | 1,274 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,248 KB |
testcase_02 | AC | 1 ms
5,248 KB |
testcase_03 | WA | - |
testcase_04 | AC | 12 ms
5,248 KB |
testcase_05 | AC | 1 ms
5,248 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 13 ms
9,216 KB |
testcase_10 | AC | 1 ms
5,248 KB |
testcase_11 | AC | 1 ms
5,248 KB |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class 1 | N,T,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 'T' [-Wimplicit-int] 1 | N,T,A; | ^ main.c:1:5: warning: type defaults to 'int' in declaration of 'A' [-Wimplicit-int] 1 | N,T,A; | ^ main.c:3:1: warning: data definition has no type or storage class 3 | i,v; | ^ main.c:3:1: warning: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] main.c:3:3: warning: type defaults to 'int' in declaration of 'v' [-Wimplicit-int] 3 | i,v; | ^ 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%d%d",&N,&T,&A); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | N,T,A; main.c:5:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 5 | scanf("%d%d%d",&N,&T,&A); | ^~~~~ main.c:5:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:23:17: warning: implicit declaration of function 'putchar' [-Wimplicit-function-declaration] 23 | putchar(d[N][T]>>i&1?'+':'*'); | ^~~~~~~ main.c:23:17: note: include '<stdio.h>' or provide a declaration of 'putchar' main.c:25:9: warning: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 25 | puts(""); | ^~~~ main.c:25:9: note: include '<stdio.h>' or provide a declaration of 'puts'
ソースコード
N,T,A; long d[51][100001]; i,v; main(){ scanf("%d%d%d",&N,&T,&A); d[1][A]=1; for(i=2;i<=N;++i){ scanf("%d",&A); for(v=1;v<=T;++v){ if(d[i-1][v]){ if(v+A<=T){ d[i][v+A]=d[i-1][v]*2+1; } if(v*A<=T){ if(d[i-1][v]*2>d[i][v*A]){ d[i][v*A]=d[i-1][v]*2; } } } } } for(i=N-2;i>=0;--i){ putchar(d[N][T]>>i&1?'+':'*'); } puts(""); }