結果

問題 No.172 UFOを捕まえろ
ユーザー Kaito Koike
提出日時 2018-03-31 12:06:35
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 645 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-06-26 01:20:04
合計ジャッジ時間 1,913 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:11: SyntaxWarning: "is not" with 'int' literal. Did you mean "!="?
  if x is not 0:

ソースコード

diff #

import math

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

#ゆきちゃんからUFOの中心までのマンハッタン距離
center_dist = abs(x)+abs(y)

#UFOの境界においてゆきちゃんから最も遠い場所

#UFO中心とゆきちゃんのなす角
if x is not 0:
    theta = math.atan(y/x)
    UFO_x = r * math.cos(theta)
    UFO_y = r * math.sin(theta)
else:
    theta = math.pi/4
    UFO_x = r * math.cos(theta)
    UFO_y = r * math.sin(theta)

#UFO外縁で最も遠い場所でのマンハッタン距離
dist = center_dist + abs(UFO_x) + abs(UFO_y)

if dist - int(dist) > 0 :
    print(int(dist) + 1)
else:
    print(int(dist))
0