結果
| 問題 |
No.172 UFOを捕まえろ
|
| コンテスト | |
| ユーザー |
weaken
|
| 提出日時 | 2021-10-18 21:56:10 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 863 bytes |
| コンパイル時間 | 73 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2024-09-19 18:26:25 |
| 合計ジャッジ時間 | 1,475 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 15 |
ソースコード
import math
def pos(x, y, r, degree):
rad = math.radians(degree)
return (r * math.cos(rad) + x, r * math.sin(rad) + y)
def within(r, x, y):
is_within = True
# right top
is_within &= y < -x + r
# right bottom
is_within &= y > x - r
# left bottom
is_within &= y > -x - r
# left top
is_within &= y < x + r
return is_within
def main():
x, y, r = map(int, input().split())
x1, y1 = 0.0, 0.0
if x >= 0 and y >= 0:
x1, y1 = pos(x, y, r, 45)
elif x >= 0 and y <= 0:
x1, y1 = pos(x, y, r, 135)
elif x <= 0 and y <= 0:
x1, y1 = pos(x, y, r, 225)
else:
x1, y1 = pos(x, y, r, 315)
manhattan = 0
for i in range(0, 200):
if within(i, x1, y1):
manhattan = i
break
print(manhattan)
if __name__ == "__main__":
main()
weaken