結果

問題 No.27 板の準備
ユーザー cielciel
提出日時 2015-11-26 17:57:01
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 380 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 21,248 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-08 00:13:31
合計ジャッジ時間 979 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 4 ms
5,376 KB
testcase_04 AC 4 ms
5,376 KB
testcase_05 AC 3 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 4 ms
5,376 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 4 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 4 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
    2 | B[99],V[4],X[4],T=98,R,i,j,r;main(){
      | ^
main.c:2:1: warning: type defaults to ‘int’ in declaration of ‘B’ [-Wimplicit-int]
main.c:2:7: warning: type defaults to ‘int’ in declaration of ‘V’ [-Wimplicit-int]
    2 | B[99],V[4],X[4],T=98,R,i,j,r;main(){
      |       ^
main.c:2:12: warning: type defaults to ‘int’ in declaration of ‘X’ [-Wimplicit-int]
    2 | B[99],V[4],X[4],T=98,R,i,j,r;main(){
      |            ^
main.c:2:17: warning: type defaults to ‘int’ in declaration of ‘T’ [-Wimplicit-int]
    2 | B[99],V[4],X[4],T=98,R,i,j,r;main(){
      |                 ^
main.c:2:22: warning: type defaults to ‘int’ in declaration of ‘R’ [-Wimplicit-int]
    2 | B[99],V[4],X[4],T=98,R,i,j,r;main(){
      |                      ^
main.c:2:24: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int]
    2 | B[99],V[4],X[4],T=98,R,i,j,r;main(){
      |                        ^
main.c:2:26: warning: type defaults to ‘int’ in declaration of ‘j’ [-Wimplicit-int]
    2 | B[99],V[4],X[4],T=98,R,i,j,r;main(){
      |                          ^
main.c:2:28: warning: type defaults to ‘int’ in declaration of ‘r’ [-Wimplicit-int]
    2 | B[99],V[4],X[4],T=98,R,i,j,r;main(){
      |                            ^
main.c:2:30: warning: return type defaults to ‘int’ [-Wimplicit-int]
    2 | B[99],V[4],X[4],T=98,R,i,j,r;main(){
      |                              ^~~~
main.c: In function ‘main’:
main.c:3:5: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    3 |     scanf("%d%d%d%d",V,V+1,V+2,V+3);R=T;
      |     ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | #define Z(i)for(X[i]=X[i-1]+1;X[i]<31;X[i]++)
main.c:3:5: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaratio

ソースコード

diff #

#define Z(i)for(X[i]=X[i-1]+1;X[i]<31;X[i]++)
B[99],V[4],X[4],T=98,R,i,j,r;main(){
    scanf("%d%d%d%d",V,V+1,V+2,V+3);R=T;
    Z(1)Z(2)Z(3){
        for(j=-1;++j<=T;)B[j]=!j;
        for(i=4;--i>0;)for(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>3&&R>r)R=r;
    }
    R=!printf("%d\n",R);
}
0