結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,576 KB
testcase_01 AC 3 ms
4,568 KB
testcase_02 AC 3 ms
4,596 KB
testcase_03 AC 2,778 ms
134,460 KB
testcase_04 AC 270 ms
14,720 KB
testcase_05 AC 2 ms
4,640 KB
testcase_06 AC 2,780 ms
133,940 KB
testcase_07 AC 904 ms
58,296 KB
testcase_08 AC 194 ms
21,832 KB
testcase_09 AC 226 ms
27,000 KB
testcase_10 AC 4 ms
4,984 KB
testcase_11 AC 4 ms
4,624 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

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