結果
| 問題 | No.126 2基のエレベータ |
| コンテスト | |
| ユーザー |
togaerror
|
| 提出日時 | 2015-03-25 22:20:25 |
| 言語 | Perl (5.42.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 564 bytes |
| 記録 | |
| コンパイル時間 | 463 ms |
| コンパイル使用メモリ | 7,844 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-03-18 09:34:33 |
| 合計ジャッジ時間 | 1,330 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 13 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
#!/usr/bin/perl
use warnings;
use strict;
my ($a, $b, $s) = split / /, <>;
my ($x, $y);
my $count = 0;
if($a < $s) {
$x = $s - $a;
} else {
$x = $a - $s;
}
if($b < $s) {
$y = $s - $b;
} else {
$y = $b - $s;
}
if($s == 1) {
$count = $x + $a + 1;
} elsif ($x <= $y) {
$count = $x + $s;
} else {
if($a < $b) {
if($b - 1 < $b - $a) {
$count = $y + $b - $a + 1;
} else {
$count = $y + $b;
}
} else {
if($b - 1 < $a - $b) {
$count = $y + $a - $b + 1;
} else {
$count = $y + $b;
}
}
$count = $y + $s;
}
print "$count\n";
exit;
togaerror