結果

問題 No.297 カードの数式
ユーザー tailstails
提出日時 2015-11-07 01:19:05
言語 Perl
(5.38.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 254 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 5,300 KB
実行使用メモリ 4,852 KB
最終ジャッジ日時 2023-08-26 22:49:30
合計ジャッジ時間 1,255 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,852 KB
testcase_01 AC 3 ms
4,676 KB
testcase_02 AC 2 ms
4,744 KB
testcase_03 AC 3 ms
4,820 KB
testcase_04 AC 3 ms
4,668 KB
testcase_05 AC 3 ms
4,788 KB
testcase_06 AC 2 ms
4,548 KB
testcase_07 AC 2 ms
4,664 KB
testcase_08 AC 2 ms
4,780 KB
testcase_09 AC 3 ms
4,656 KB
testcase_10 AC 2 ms
4,740 KB
testcase_11 AC 2 ms
4,680 KB
testcase_12 AC 3 ms
4,744 KB
testcase_13 AC 3 ms
4,560 KB
testcase_14 AC 2 ms
4,668 KB
testcase_15 AC 3 ms
4,548 KB
testcase_16 AC 2 ms
4,660 KB
testcase_17 AC 2 ms
4,652 KB
testcase_18 AC 2 ms
4,744 KB
testcase_19 AC 3 ms
4,652 KB
testcase_20 AC 2 ms
4,548 KB
testcase_21 AC 2 ms
4,672 KB
testcase_22 AC 2 ms
4,684 KB
testcase_23 AC 2 ms
4,800 KB
testcase_24 AC 2 ms
4,540 KB
testcase_25 AC 3 ms
4,668 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::i" used only once: possible typo at Main.pl line 8.
Main.pl syntax OK

ソースコード

diff #

<>;@a=reverse sort<>=~/\S/g;
pop@a while$a[-1]eq'+'&&++$p||$a[-1]eq'-'&&++$m;
@d=@b=@a;$"='';
$y-=pop@a for 1..$m;
$y+=pop@a for 1..$p;
$z+=pop@b for 0..$p;
$z-=pop@b for 2..$m;
$c[$i++%($p+1)]=~s/^/$_/ for@d;
$x+=$_ for@c;
print$y+"@a"," ",$m?$z-"@b":$x
0