結果

問題 No.126 2基のエレベータ
ユーザー togaerrortogaerror
提出日時 2015-03-25 22:56:32
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 375 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 5,336 KB
実行使用メモリ 5,120 KB
最終ジャッジ日時 2023-09-11 10:16:05
合計ジャッジ時間 1,392 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 5 ms
4,956 KB
testcase_04 AC 5 ms
4,936 KB
testcase_05 AC 5 ms
4,900 KB
testcase_06 AC 5 ms
4,800 KB
testcase_07 WA -
testcase_08 AC 5 ms
5,104 KB
testcase_09 WA -
testcase_10 AC 5 ms
4,964 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 5 ms
4,812 KB
testcase_18 WA -
testcase_19 AC 5 ms
4,904 KB
testcase_20 WA -
testcase_21 AC 4 ms
4,844 KB
testcase_22 WA -
testcase_23 AC 4 ms
5,068 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/perl

use warnings;
use strict;

my ($a, $b, $s) = split / /, <>;
my $x = $a - $s;
my $y = $b - $s;
my $count = 0;

if($x < 0) {
	$x *= -1;
}

if($y < 0) {
	$y *= -1;
}

if($a <= $b) {
	$count = $x + $s;
} else {
	$count = $y;
	$y = $a - $b;
	if($y < 0) {
		$y *= -1;
	}
	if($a < $y) {
		$count += $a;
	} else {
		$count += $y + $a;
	}
}

print "$count\n";

exit;
0