結果
問題 | No.247 線形計画問題もどき |
ユーザー | ciel |
提出日時 | 2015-07-17 23:34:25 |
言語 | C90 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 280 bytes |
コンパイル時間 | 202 ms |
コンパイル使用メモリ | 20,224 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-08 09:37:26 |
合計ジャッジ時間 | 1,056 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 0 ms
5,376 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | WA | - |
testcase_11 | AC | 0 ms
5,376 KB |
testcase_12 | AC | 1 ms
5,376 KB |
testcase_13 | WA | - |
testcase_14 | AC | 0 ms
5,376 KB |
testcase_15 | WA | - |
testcase_16 | AC | 0 ms
5,376 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 0 ms
5,376 KB |
testcase_22 | WA | - |
testcase_23 | AC | 1 ms
5,376 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 1 ms
5,376 KB |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class 1 | a[100],b[100000],C,N,i,k; | ^ main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘a’ [-Wimplicit-int] main.c:1:8: warning: type defaults to ‘int’ in declaration of ‘b’ [-Wimplicit-int] 1 | a[100],b[100000],C,N,i,k; | ^ main.c:1:18: warning: type defaults to ‘int’ in declaration of ‘C’ [-Wimplicit-int] 1 | a[100],b[100000],C,N,i,k; | ^ main.c:1:20: warning: type defaults to ‘int’ in declaration of ‘N’ [-Wimplicit-int] 1 | a[100],b[100000],C,N,i,k; | ^ main.c:1:22: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int] 1 | a[100],b[100000],C,N,i,k; | ^ main.c:1:24: warning: type defaults to ‘int’ in declaration of ‘k’ [-Wimplicit-int] 1 | a[100],b[100000],C,N,i,k; | ^ main.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 3 | main(m){ | ^~~~ main.c: In function ‘main’: main.c:3:1: warning: type of ‘m’ defaults to ‘int’ [-Wimplicit-int] main.c:4:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 4 | scanf("%d%d",&C,&N); | ^~~~~ main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ +++ |+#include <stdio.h> 1 | a[100],b[100000],C,N,i,k; main.c:4:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch] 4 | scanf("%d%d",&C,&N); | ^~~~~ main.c:4:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:14:9: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] 14 | printf("%d\n",b[C]?:-1); | ^~~~~~ main.c:14:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ main.c:14
ソースコード
a[100],b[100000],C,N,i,k; main(m){ scanf("%d%d",&C,&N); for(;i<N;i++)scanf("%d",a+i); for(;m<=N;m++){ k=-1; for(i=0;i<N;i++){ if(m >= a[i] && b[m-a[i]] >= 0 && (k < 0 || b[m-a[i]] + 1 < k)) k = b[m-a[i]] + 1; } b[m] = k; } printf("%d\n",b[C]?:-1); exit(0); }