結果

問題 No.48 ロボットの操縦
ユーザー pajannatpajannat
提出日時 2021-04-05 22:20:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 595 bytes
コンパイル時間 1,282 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 71,676 KB
最終ジャッジ日時 2023-08-30 09:28:27
合計ジャッジ時間 3,818 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,352 KB
testcase_01 AC 73 ms
71,348 KB
testcase_02 AC 70 ms
71,636 KB
testcase_03 AC 71 ms
71,236 KB
testcase_04 AC 72 ms
71,552 KB
testcase_05 AC 70 ms
71,356 KB
testcase_06 AC 72 ms
71,140 KB
testcase_07 AC 71 ms
71,588 KB
testcase_08 AC 72 ms
71,280 KB
testcase_09 AC 70 ms
71,420 KB
testcase_10 AC 71 ms
71,380 KB
testcase_11 AC 72 ms
71,372 KB
testcase_12 AC 71 ms
71,676 KB
testcase_13 AC 72 ms
71,284 KB
testcase_14 AC 72 ms
71,488 KB
testcase_15 AC 72 ms
71,628 KB
testcase_16 AC 72 ms
71,356 KB
testcase_17 AC 71 ms
71,676 KB
testcase_18 AC 71 ms
71,152 KB
testcase_19 AC 72 ms
71,280 KB
testcase_20 AC 74 ms
71,348 KB
testcase_21 AC 73 ms
71,440 KB
testcase_22 AC 74 ms
71,372 KB
testcase_23 AC 74 ms
71,160 KB
testcase_24 AC 71 ms
71,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
X = int(input())
Y = int(input())
L = int(input())

cnt = 0

if X == 0:
	if Y == 0:
		cnt = 0
	elif Y > 0:
		cnt += math.ceil(abs(Y)/L)
	else:
		cnt += math.ceil(abs(Y)/L) + 2
elif X > 0:
	if Y == 0:
		cnt += math.ceil(abs(X)/L) + 1
	elif Y > 0:
		cnt += math.ceil(abs(X)/L) + math.ceil(abs(Y)/L) + 1
	else:
		cnt += math.ceil(abs(X)/L) + math.ceil(abs(Y)/L) + 2
else:
	if Y == 0:
		cnt += math.ceil(abs(X)/L) + 1
	elif Y > 0:
		cnt += math.ceil(abs(X)/L) + math.ceil(abs(Y)/L) + 1
	else:
		cnt += math.ceil(abs(X)/L)+ math.ceil(abs(Y)/L) + 2

print(cnt)
0