結果

問題 No.131 マンハッタン距離
ユーザー togaerrortogaerror
提出日時 2015-03-18 02:52:03
言語 Perl
(5.38.2)
結果
AC  
実行時間 5 ms / 5,000 ms
コード長 299 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 5,328 KB
実行使用メモリ 5,120 KB
最終ジャッジ日時 2023-09-11 08:32:48
合計ジャッジ時間 1,296 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
5,120 KB
testcase_01 AC 5 ms
5,100 KB
testcase_02 AC 5 ms
5,116 KB
testcase_03 AC 5 ms
5,016 KB
testcase_04 AC 5 ms
5,008 KB
testcase_05 AC 5 ms
5,120 KB
testcase_06 AC 4 ms
5,016 KB
testcase_07 AC 5 ms
5,104 KB
testcase_08 AC 5 ms
4,980 KB
testcase_09 AC 5 ms
4,972 KB
testcase_10 AC 5 ms
4,976 KB
testcase_11 AC 5 ms
4,924 KB
testcase_12 AC 5 ms
5,092 KB
testcase_13 AC 5 ms
4,840 KB
testcase_14 AC 5 ms
5,104 KB
testcase_15 AC 5 ms
4,980 KB
testcase_16 AC 5 ms
4,920 KB
testcase_17 AC 5 ms
5,036 KB
testcase_18 AC 5 ms
4,920 KB
testcase_19 AC 5 ms
4,980 KB
testcase_20 AC 5 ms
4,760 KB
testcase_21 AC 5 ms
5,040 KB
testcase_22 AC 5 ms
5,084 KB
testcase_23 AC 5 ms
4,924 KB
testcase_24 AC 5 ms
4,796 KB
testcase_25 AC 5 ms
4,920 KB
testcase_26 AC 5 ms
5,064 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/perl

use strict;
use warnings;

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

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

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

print "$count\n";

exit;
0