結果

問題 No.178 美しいWhitespace (1)
ユーザー tailstails
提出日時 2015-04-05 23:30:05
言語 Perl
(5.38.2)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 217 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 5,068 KB
最終ジャッジ日時 2023-09-17 04:41:47
合計ジャッジ時間 1,374 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,808 KB
testcase_01 AC 3 ms
4,640 KB
testcase_02 AC 3 ms
4,672 KB
testcase_03 AC 2 ms
4,688 KB
testcase_04 AC 4 ms
5,004 KB
testcase_05 AC 4 ms
5,000 KB
testcase_06 AC 4 ms
4,884 KB
testcase_07 AC 3 ms
4,884 KB
testcase_08 AC 4 ms
4,788 KB
testcase_09 AC 4 ms
5,012 KB
testcase_10 AC 4 ms
4,936 KB
testcase_11 AC 3 ms
4,764 KB
testcase_12 AC 3 ms
4,820 KB
testcase_13 AC 4 ms
4,908 KB
testcase_14 AC 4 ms
4,932 KB
testcase_15 AC 4 ms
4,940 KB
testcase_16 AC 4 ms
4,836 KB
testcase_17 AC 4 ms
4,828 KB
testcase_18 AC 3 ms
4,652 KB
testcase_19 AC 4 ms
5,068 KB
testcase_20 AC 3 ms
4,888 KB
testcase_21 AC 4 ms
4,904 KB
testcase_22 AC 4 ms
5,060 KB
testcase_23 AC 5 ms
4,752 KB
testcase_24 AC 4 ms
4,632 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

<>;
$_=<>;
($a,$b)=/\d+/g;
$x=$a+4*$b;
for(<>){
    ++$l;
    ($a,$b)=/\d+/g;
    $y=$a+4*$b;
    if($x+$y&1){
	print -1;
	exit;
    }
    if($x<$y){
	$s+=$l*($y-$x);
	$x=$y;
    }else{
	$s+=$x-$y;
    }
}
print $s/2;
0