結果

問題 No.172 UFOを捕まえろ
ユーザー aqua_tenhouaqua_tenhou
提出日時 2021-06-20 22:58:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 435 bytes
コンパイル時間 1,073 ms
コンパイル使用メモリ 86,796 KB
実行使用メモリ 71,832 KB
最終ジャッジ日時 2023-09-05 01:44:06
合計ジャッジ時間 3,642 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,440 KB
testcase_01 AC 73 ms
71,648 KB
testcase_02 AC 76 ms
71,656 KB
testcase_03 AC 74 ms
71,460 KB
testcase_04 AC 71 ms
71,324 KB
testcase_05 AC 73 ms
71,724 KB
testcase_06 AC 73 ms
71,636 KB
testcase_07 AC 74 ms
71,436 KB
testcase_08 AC 74 ms
71,700 KB
testcase_09 AC 74 ms
71,384 KB
testcase_10 AC 74 ms
71,768 KB
testcase_11 AC 75 ms
71,388 KB
testcase_12 AC 73 ms
71,796 KB
testcase_13 AC 75 ms
71,628 KB
testcase_14 AC 74 ms
71,832 KB
testcase_15 AC 75 ms
71,828 KB
testcase_16 AC 75 ms
71,832 KB
testcase_17 AC 73 ms
71,704 KB
testcase_18 AC 74 ms
71,584 KB
testcase_19 AC 74 ms
71,728 KB
testcase_20 AC 76 ms
71,624 KB
testcase_21 AC 73 ms
71,652 KB
testcase_22 AC 74 ms
71,688 KB
testcase_23 AC 72 ms
71,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

x,y,r = map(int,input().split())
x, y = abs(x), abs(y)

#点と直線の距離  dis(ax + by + c = 0, (x0, y0))
def dis_point_to_line(a,b,c,x0,y0):
    if a == 0:
        ans = abs(y0-c/b)
    elif b == 0:
        ans = abs(x0-c/a)
    else:
        ans = abs(a*x0 + b*y0 + c)/((a**2 + b**2)**0.5)
    return(ans)

for i in range(x+y, 1000):
    ret = dis_point_to_line(1, 1, -i, x , y)
    if ret > r:
        print(i)
        exit()

0