結果
問題 | No.172 UFOを捕まえろ |
ユーザー | weaken |
提出日時 | 2021-10-18 21:56:10 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 863 bytes |
コンパイル時間 | 191 ms |
コンパイル使用メモリ | 12,040 KB |
実行使用メモリ | 10,484 KB |
最終ジャッジ日時 | 2023-10-19 22:26:57 |
合計ジャッジ時間 | 1,947 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 30 ms
10,396 KB |
testcase_02 | AC | 29 ms
10,396 KB |
testcase_03 | AC | 30 ms
10,396 KB |
testcase_04 | AC | 30 ms
10,396 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 30 ms
10,396 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 30 ms
10,396 KB |
testcase_16 | WA | - |
testcase_17 | AC | 29 ms
10,396 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 30 ms
10,396 KB |
testcase_21 | WA | - |
testcase_22 | AC | 30 ms
10,396 KB |
testcase_23 | WA | - |
ソースコード
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()