結果

問題 No.149 碁石の移動
ユーザー togaerror
提出日時 2015-03-14 16:24:53
言語 Perl
(5.40.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 6,688 KB
実行使用メモリ 5,760 KB
最終ジャッジ日時 2024-12-24 02:55:17
合計ジャッジ時間 979 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
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