結果

問題 No.527 ナップサック容量問題
ユーザー 👑 testestest
提出日時 2017-06-20 12:10:33
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 195 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 28,032 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-02 03:49:28
合計ジャッジ時間 1,332 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
    2 | a[1<<17],*d=a+1000;
      | ^
main.c:2:1: warning: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:2:11: warning: type defaults to 'int' in declaration of 'd' [-Wimplicit-int]
    2 | a[1<<17],*d=a+1000;
      |           ^
main.c:3:1: warning: data definition has no type or storage class
    3 | v,w;s,j;
      | ^
main.c:3:1: warning: type defaults to 'int' in declaration of 'v' [-Wimplicit-int]
main.c:3:3: warning: type defaults to 'int' in declaration of 'w' [-Wimplicit-int]
    3 | v,w;s,j;
      |   ^
main.c:3:5: warning: data definition has no type or storage class
    3 | v,w;s,j;
      |     ^
main.c:3:5: warning: type defaults to 'int' in declaration of 's' [-Wimplicit-int]
main.c:3:7: warning: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
    3 | v,w;s,j;
      |       ^
main.c:4:1: warning: return type defaults to 'int' [-Wimplicit-int]
    4 | main(t){
      | ^~~~
main.c: In function 'main':
main.c:4:1: warning: type of 't' defaults to 'int' [-Wimplicit-int]
main.c:5:15: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    5 |         for(;~scanf("%d%d",&w,&t);j=s+=v=t)for(;j;j--)d[j]=minz(d[j],d[j-v]+w);
      |               ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #define minz(p,q)(p&&p<q?p:q)
main.c:5:15: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    5 |         for(;~scanf("%d%d",&w,&t);j=s+=v=t)for(;j;j--)d[j]=minz(d[j],d[j-v]+w);
      |               ^~~~~
main.c:5:15: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:6:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    6 |         printf(d[t+1]?"%d\n%d":"%d\ninf",d[t]?:1,d[t+1]-1);
      |         ^~~~~~
main.c:6:9: note: include '<stdio.h>' or provide a dec

ソースコード

diff #
プレゼンテーションモードにする

#define minz(p,q)(p&&p<q?p:q)
a[1<<17],*d=a+1000;
v,w;s,j;
main(t){
for(;~scanf("%d%d",&w,&t);j=s+=v=t)for(;j;j--)d[j]=minz(d[j],d[j-v]+w);
printf(d[t+1]?"%d\n%d":"%d\ninf",d[t]?:1,d[t+1]-1);
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0