結果
問題 | No.27 板の準備 |
ユーザー | ciel |
提出日時 | 2015-07-14 16:42:41 |
言語 | C90 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 391 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 20,864 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-08 07:13:32 |
合計ジャッジ時間 | 695 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 3 ms
5,376 KB |
testcase_07 | AC | 3 ms
5,376 KB |
testcase_08 | AC | 3 ms
5,376 KB |
testcase_09 | AC | 3 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 2 ms
5,376 KB |
testcase_14 | AC | 1 ms
5,376 KB |
testcase_15 | AC | 2 ms
5,376 KB |
testcase_16 | AC | 2 ms
5,376 KB |
testcase_17 | AC | 2 ms
5,376 KB |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class 1 | B[999],V[4],X[3],T,R,i,j,r;main(){ | ^ main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘B’ [-Wimplicit-int] main.c:1:8: warning: type defaults to ‘int’ in declaration of ‘V’ [-Wimplicit-int] 1 | B[999],V[4],X[3],T,R,i,j,r;main(){ | ^ main.c:1:13: warning: type defaults to ‘int’ in declaration of ‘X’ [-Wimplicit-int] 1 | B[999],V[4],X[3],T,R,i,j,r;main(){ | ^ main.c:1:18: warning: type defaults to ‘int’ in declaration of ‘T’ [-Wimplicit-int] 1 | B[999],V[4],X[3],T,R,i,j,r;main(){ | ^ main.c:1:20: warning: type defaults to ‘int’ in declaration of ‘R’ [-Wimplicit-int] 1 | B[999],V[4],X[3],T,R,i,j,r;main(){ | ^ main.c:1:22: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int] 1 | B[999],V[4],X[3],T,R,i,j,r;main(){ | ^ main.c:1:24: warning: type defaults to ‘int’ in declaration of ‘j’ [-Wimplicit-int] 1 | B[999],V[4],X[3],T,R,i,j,r;main(){ | ^ main.c:1:26: warning: type defaults to ‘int’ in declaration of ‘r’ [-Wimplicit-int] 1 | B[999],V[4],X[3],T,R,i,j,r;main(){ | ^ main.c:1:28: warning: return type defaults to ‘int’ [-Wimplicit-int] 1 | B[999],V[4],X[3],T,R,i,j,r;main(){ | ^~~~ main.c: In function ‘main’: main.c:2:25: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 2 | for(i=0;i<4;i++)scanf("%d",&V[i]),T+=V[i];R=T; | ^~~~~ main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ +++ |+#include <stdio.h> 1 | B[999],V[4],X[3],T,R,i,j,r;main(){ main.c:2:25: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaratio
ソースコード
B[999],V[4],X[3],T,R,i,j,r;main(){ for(i=0;i<4;i++)scanf("%d",&V[i]),T+=V[i];R=T; for(X[0]=1;X[0]<=30;X[0]++)for(X[1]=X[0]+1;X[1]<=30;X[1]++)for(X[2]=X[1]+1;X[2]<=30;X[2]++){ for(j=0;j<=T;j++)B[j]=!j; for(i=0;i<3;i++)for(int j=X[i];j<=T;j++)if(B[j-X[i]]&&(!B[j]||B[j]>B[j-X[i]]))B[j]=B[j-X[i]]+1; for(i=r=0;i<4&&B[V[i]];)r+=B[V[i++]]-1; if(i==4&&R>r)R=r; } R=!printf("%d\n",R); }