結果
| 問題 | No.48 ロボットの操縦 |
| コンテスト | |
| ユーザー |
fmhr
|
| 提出日時 | 2015-05-22 18:22:33 |
| 言語 | Go (1.23.4) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 673 bytes |
| コンパイル時間 | 17,681 ms |
| コンパイル使用メモリ | 239,364 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-21 18:21:10 |
| 合計ジャッジ時間 | 13,502 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
package main
import (
"fmt"
"math"
)
func intabs(a int) int {
return int(math.Abs(float64(a)))
}
func main() {
var x, y, l, ans int
fmt.Scan(&x, &y, &l)
ans = intabs(x)/l + intabs(y)/l
if intabs(x)%l != 0 {
ans += 1
}
if intabs(y)%l != 0 {
ans += 1
}
//fmt.Println(ans, (x+y)%l)
if x == 0 && y == 0 {
//ans := 0
} else if x == 0 && y > 0 {
//ans := 0
} else if x < 0 && y > 0 {
ans += 1
} else if x < 0 && y == 0 {
ans += 1
} else if x < 0 && y < 0 {
ans += 2
} else if x == 0 && y < 0 {
ans += 2
} else if x > 0 && y < 0 {
ans += 2
} else if x > 0 && y == 0 {
ans += 1
} else if x > 0 && y > 0 {
ans += 1
}
fmt.Println(ans)
}
fmhr