結果

問題 No.149 碁石の移動
ユーザー togaerrortogaerror
提出日時 2015-03-14 16:24:53
言語 Perl
(5.38.2)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 646 ms
コンパイル使用メモリ 5,364 KB
実行使用メモリ 5,052 KB
最終ジャッジ日時 2023-08-25 17:28:15
合計ジャッジ時間 1,300 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,988 KB
testcase_01 AC 5 ms
4,992 KB
testcase_02 AC 5 ms
4,816 KB
testcase_03 AC 5 ms
4,828 KB
testcase_04 AC 4 ms
4,756 KB
testcase_05 AC 4 ms
4,984 KB
testcase_06 AC 5 ms
4,996 KB
testcase_07 AC 5 ms
4,856 KB
testcase_08 AC 5 ms
4,828 KB
testcase_09 AC 5 ms
4,992 KB
testcase_10 AC 4 ms
4,796 KB
testcase_11 AC 5 ms
4,984 KB
testcase_12 AC 4 ms
4,820 KB
testcase_13 AC 5 ms
5,052 KB
testcase_14 AC 5 ms
5,028 KB
testcase_15 AC 5 ms
4,772 KB
testcase_16 AC 4 ms
4,992 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/perl

use strict;
use warnings;

my ($a_w, $a_b) = split / /, <>;
my ($b_w, $b_b) = split / /, <>;
my ($c, $d) = split / /, <>;

if($a_b < $c) {
	$b_b += $a_b;
	$c -= $a_b;
	$a_w -= $c;
	$b_w += $c;
} else {
	$a_b -= $c;
	$b_b += $c;
}

if($b_w < $d) {
	$a_w += $b_w;
} else {
	$a_w += $d;
}

print "$a_w\n";

exit;
0