結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-01-17 06:38:42 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 598 bytes |
| コンパイル時間 | 10,013 ms |
| コンパイル使用メモリ | 238,704 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-25 00:10:00 |
| 合計ジャッジ時間 | 10,875 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 12 |
ソースコード
package main
import (
"fmt"
"math"
"sort"
)
func MaxInt(x, y int) int {
return int(math.Max(float64(x), float64(y)))
}
func MinInt(x, y int) int {
return int(math.Min(float64(x), float64(y)))
}
func AbsInt(x int) int {
return int(math.Abs(float64(x)))
}
func SortInt(d []int) {
sort.Sort(sort.IntSlice(d))
}
func resolve(A, B, S int) int {
if A >= S {
return A
}
if AbsInt(S-A) <= AbsInt(B-S) {
return S - A + S
}
if A == 0 {
return B - S + S + 1
}
return B - S + S
}
func main() {
var A, B, S int
fmt.Scanf("%d %d %d\n", &A, &B, &S)
fmt.Println(resolve(A, B, S))
}