結果

問題 No.760 Where am I moved to?
ユーザー maspymaspy
提出日時 2020-03-31 17:06:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 832 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 10,844 KB
実行使用メモリ 8,692 KB
最終ジャッジ日時 2023-09-07 02:07:20
合計ジャッジ時間 5,755 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,548 KB
testcase_01 AC 16 ms
8,324 KB
testcase_02 AC 16 ms
8,456 KB
testcase_03 AC 17 ms
8,692 KB
testcase_04 AC 16 ms
8,576 KB
testcase_05 AC 16 ms
8,572 KB
testcase_06 AC 17 ms
8,572 KB
testcase_07 AC 16 ms
8,576 KB
testcase_08 AC 17 ms
8,596 KB
testcase_09 AC 17 ms
8,660 KB
testcase_10 AC 16 ms
8,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from math import sin, cos, atan2, pi
xa, ya, ta = map(float, readline().split())
za = complex(xa, ya)
z1 = complex(*map(float, readline().split()))
z2 = complex(*map(float, readline().split()))
z21 = complex(*map(float, readline().split()))
z22 = complex(*map(float, readline().split()))

ta = ta * pi / 180


def world_to_ship(z, za, ta):
    return (z - za) / complex(cos(ta), sin(ta))


"""
def ship_to_world(w, za, ta):
    return w * complex(cos(ta), sin(ta)) + za
"""

w1 = world_to_ship(z21, za, ta)
w2 = world_to_ship(z22, za, ta)
rotate = (z2 - z1) / (w2 - w1)
tb = atan2(rotate.imag, rotate.real)
zb = z1 - w1 * rotate

xb = zb.real
yb = zb.imag
tb = tb * 180 / pi
print(xb, yb, tb)
0