結果

問題 No.10 +か×か
ユーザー %20%20
提出日時 2017-07-11 00:27:25
言語 Perl
(5.38.2)
結果
AC  
実行時間 2,018 ms / 5,000 ms
コード長 377 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 106,992 KB
最終ジャッジ日時 2023-08-21 06:23:08
合計ジャッジ時間 6,477 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,564 KB
testcase_01 AC 3 ms
4,460 KB
testcase_02 AC 3 ms
4,560 KB
testcase_03 AC 2,018 ms
106,992 KB
testcase_04 AC 304 ms
6,548 KB
testcase_05 AC 3 ms
4,564 KB
testcase_06 AC 2,000 ms
106,268 KB
testcase_07 AC 836 ms
29,520 KB
testcase_08 AC 170 ms
14,184 KB
testcase_09 AC 208 ms
16,776 KB
testcase_10 AC 5 ms
4,508 KB
testcase_11 AC 3 ms
4,560 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

$N=<>;
$T=<>;
$/=$";
$d[1][<>]=1;
for$i(2..$N){
	$A=<>;
	for$v(1..$T){
		if($d[$i-1][$v]){
			if($v+$A<=$T){
				if($d[$i-1][$v]*2+1>$d[$i][$v+$A]){
					$d[$i][$v+$A]=$d[$i-1][$v]*2+1;
				}
			}
			if($v*$A<=$T){
				if($d[$i-1][$v]*2>$d[$i][$v*$A]){
					$d[$i][$v*$A]=$d[$i-1][$v]*2;
				}
			}
		}
	}
}
for$i(reverse 0..$N-2){
	print$d[$N][$T]>>$i&1?'+':'*';
}
print"\n";
0