結果

問題 No.1947 質より種類数
ユーザー tailstails
提出日時 2022-05-20 22:10:28
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 381 bytes
コンパイル時間 703 ms
コンパイル使用メモリ 29,392 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 12:52:26
合計ジャッジ時間 2,285 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 1 ms
4,348 KB
testcase_32 AC 1 ms
4,348 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 2 ms
4,348 KB
testcase_36 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:4:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    4 |         scanf("%ld%ld%ld",&n,&t,&c);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | char d[5001];
main.c:4:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    4 |         scanf("%ld%ld%ld",&n,&t,&c);
      |         ^~~~~
main.c:4:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:25:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   25 |         printf("%ld",z);
      |         ^~~~~~
main.c:25:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:25:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:25:9: note: include '<stdio.h>' or provide a declaration of 'printf'

ソースコード

diff #

char d[5001];
int main(){
	long n,t,c;
	scanf("%ld%ld%ld",&n,&t,&c);
	for(long i=0;i<n;++i){
		long v,w;
		scanf("%ld%ld",&v,&w);
		for(long j=0;j<=t-v;++j){
			if(d[j]<d[j+v]+w+c){
				d[j]=d[j+v]+w+c;
			}
		}
		for(long j=t-v;j>=0;--j){
			if(d[j]<d[j+v]+w){
				d[j]=d[j+v]+w;
			}
		}
	}
	long z=0;
	for(long j=0;j<=t;++j){
		if(z<d[j]){
			z=d[j];
		}
	}
	printf("%ld",z);
}
0