結果
| 問題 | No.126 2基のエレベータ |
| コンテスト | |
| ユーザー |
togaerror
|
| 提出日時 | 2015-03-25 22:20:25 |
| 言語 | Perl (5.40.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 564 bytes |
| 記録 | |
| コンパイル時間 | 30 ms |
| コンパイル使用メモリ | 5,760 KB |
| 実行使用メモリ | 5,760 KB |
| 最終ジャッジ日時 | 2024-06-29 00:57:53 |
| 合計ジャッジ時間 | 1,236 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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