結果

問題 No.131 マンハッタン距離
ユーザー togaerrortogaerror
提出日時 2015-03-18 02:27:33
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 338 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 5,328 KB
実行使用メモリ 5,148 KB
最終ジャッジ日時 2023-09-11 08:32:36
合計ジャッジ時間 1,682 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 5 ms
5,128 KB
testcase_02 AC 5 ms
4,912 KB
testcase_03 AC 5 ms
4,920 KB
testcase_04 AC 5 ms
5,004 KB
testcase_05 AC 5 ms
5,024 KB
testcase_06 AC 5 ms
5,092 KB
testcase_07 AC 5 ms
4,860 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 5 ms
5,136 KB
testcase_11 AC 5 ms
4,768 KB
testcase_12 WA -
testcase_13 AC 5 ms
5,104 KB
testcase_14 WA -
testcase_15 AC 5 ms
5,120 KB
testcase_16 AC 5 ms
5,004 KB
testcase_17 AC 5 ms
4,944 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 5 ms
4,916 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 5 ms
4,928 KB
testcase_26 AC 4 ms
5,016 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/perl

use strict;
use warnings;

my ($x, $y, $d) = split / /, <>;
my $count;

if($y < $x) {
	($x, $y) = ($y, $x);
}

if(($x <= $d)and($d <= $y)) {
	$count = $x;
} elsif($d < $x) {
	$count = $x;
} elsif($x + $y < $d) {
	$count = 0;
} elsif(($y < $d)and($d <= $y + $x)) {
	$count = $y + $x - $d + 1;
} 

print "$count\n";

exit;
0