結果

問題 No.27 板の準備
ユーザー cielciel
提出日時 2015-07-14 16:51:26
言語 C90
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 334 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-08 07:13:36
合計ジャッジ時間 805 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define Z(i)for(X[i]=X[i-1]+1;X[i]<31;X[i]++)
B[999],V[4],X[4],T,R,i,j,r;main(){
	for(i=0;i<4;i++)scanf("%d",&V[i]),T+=V[i];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]]+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