結果
| 問題 | No.126 2基のエレベータ |
| コンテスト | |
| ユーザー |
tnoda_
|
| 提出日時 | 2015-01-25 15:07:00 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 329 bytes |
| 記録 | |
| コンパイル時間 | 10,942 ms |
| コンパイル使用メモリ | 227,556 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-10 03:02:45 |
| 合計ジャッジ時間 | 12,159 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 7 WA * 20 |
ソースコード
package main
import "fmt"
func min(x, y int) int {
if y < x {
return y
}
return x
}
func abs(x int) int {
if x < 0 {
x = -x
}
return x
}
func main() {
var a, b, s, z int
fmt.Scan(&a, &b, &s)
if s == 0 {
fmt.Println(0)
return
}
if a == 0 {
a++
z++
}
z += min(abs(a-b), abs(b-s)) + s
fmt.Println(z)
}
tnoda_