結果

問題 No.48 ロボットの操縦
ユーザー cm-araicm-arai
提出日時 2021-01-02 19:16:05
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 475 bytes
コンパイル時間 19,682 ms
コンパイル使用メモリ 235,156 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-20 13:44:56
合計ジャッジ時間 17,080 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 WA -
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math"
)

func scan() (X int, Y int, L int) {
	fmt.Scan(&X, &Y, &L)
	return
}

func main() {
	var X, Y, L int
	X, Y, L = scan()
	// X, Y, L = 0, 2, 1
	// X, Y, L = -7, 15, 7
	count := 0
	if X == 0 {
		count += 0
	} else if Y >= 0 {
		count += 1
	} else if X < 0 && Y < 0 {
		count += 2
	}

	if X != 0 {
		count += (int(math.Abs(float64(X))) + L - 1) / L
	}
	if Y != 0 {
		count += (int(math.Abs(float64(Y))) + L - 1) / L
	}
	fmt.Print(count)
}
0