結果
問題 | No.10 +か×か |
ユーザー | %20 |
提出日時 | 2017-07-10 22:56:00 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 50 ms / 5,000 ms |
コード長 | 423 bytes |
コンパイル時間 | 359 ms |
コンパイル使用メモリ | 29,696 KB |
実行使用メモリ | 33,792 KB |
最終ジャッジ日時 | 2024-12-14 15:39:49 |
合計ジャッジ時間 | 1,016 ms |
ジャッジサーバーID (参考情報) |
judge3 / 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 | AC | 48 ms
33,792 KB |
testcase_04 | AC | 5 ms
5,248 KB |
testcase_05 | AC | 1 ms
5,248 KB |
testcase_06 | AC | 50 ms
32,896 KB |
testcase_07 | AC | 10 ms
8,064 KB |
testcase_08 | AC | 7 ms
6,528 KB |
testcase_09 | AC | 10 ms
9,344 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:25:17: warning: implicit declaration of function 'putchar' [-Wimplicit-function-declaration] 25 | putchar(d[N][T]>>i&1?'+':'*'); | ^~~~~~~ main.c:25:17: note: include '<stdio.h>' or provide a declaration of 'putchar' main.c:27:9: warning: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 27 | puts(""); | ^~~~ main.c:27: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){ if(d[i-1][v]*2+1>d[i][v+A]){ 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(""); }