結果
問題 | No.247 線形計画問題もどき |
ユーザー | ciel |
提出日時 | 2015-07-17 23:00:47 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 408 bytes |
コンパイル時間 | 550 ms |
コンパイル使用メモリ | 19,968 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 11:00:30 |
合計ジャッジ時間 | 1,314 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 23 |
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class 2 | a[100],b[100000],N; | ^ main.c:2:1: warning: type defaults to ‘int’ in declaration of ‘a’ [-Wimplicit-int] main.c:2:8: warning: type defaults to ‘int’ in declaration of ‘b’ [-Wimplicit-int] 2 | a[100],b[100000],N; | ^ main.c:2:18: warning: type defaults to ‘int’ in declaration of ‘N’ [-Wimplicit-int] 2 | a[100],b[100000],N; | ^ main.c: In function ‘ite’: main.c:3:6: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int] 3 | void ite(n){ | ^~~ main.c: At top level: main.c:17:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 17 | main(){ | ^~~~ main.c: In function ‘main’: main.c:19:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 19 | scanf("%d%d",&C,&N); | ^~~~~ main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ +++ |+#include <stdio.h> 1 | //icpc2010dC test using InformationScience2008[3] ite() main.c:19:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch] 19 | scanf("%d%d",&C,&N); | ^~~~~ main.c:19:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’ main.c:22:9: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] 22 | printf("%d\n",b[C]?:-1); | ^~~~~~ main.c:22:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ main.c:22:9: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch] main.c:22:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ main.c:23:9: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration] 23 | exit(0); | ^~~~ main.c:1:1: note: inc
ソースコード
//icpc2010dC test using InformationScience2008[3] ite() a[100],b[100000],N; void ite(n){ int m,k,l,i; b[0] = 0; for(m=1;m<=n;m++){ i = 0; k = l = -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; } } main(){ int C,i=0; scanf("%d%d",&C,&N); for(;i<N;i++)scanf("%d",a+i); ite(C); printf("%d\n",b[C]?:-1); exit(0); }