結果
問題 | No.131 マンハッタン距離 |
ユーザー |
![]() |
提出日時 | 2015-03-18 02:52:03 |
言語 | Perl (5.40.0) |
結果 |
AC
|
実行時間 | 7 ms / 5,000 ms |
コード長 | 299 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 5,888 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2024-06-28 23:10:03 |
合計ジャッジ時間 | 1,081 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
#!/usr/bin/perluse 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;