結果

問題 No.1932 動く点 P / Moving Point P
ユーザー 👑 Kazun
提出日時 2022-05-06 23:12:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 782 ms / 6,000 ms
コード長 624 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 94,696 KB
最終ジャッジ日時 2024-07-06 01:51:07
合計ジャッジ時間 19,721 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

def conv(p,q):
    pa,pb=p
    qa,qb=q
    return (pa*qa, pb+pa*qb)

def inv(p):
    pa,pb=p
    return (1/pa,-pb/pa)

from math import *

N=int(input())
d=[None]*(N+1); d[0]=(1,0)
for i in range(N):
    p,q,r=map(float,input().split())

    alpha=complex(p,q)
    theta=r/180*pi
    beta=complex(cos(theta), sin(theta))
    d[i+1]=(beta, alpha*(1-beta))

for i in range(1,N+1):
    d[i]=conv(d[i], d[i-1])

Q=int(input())
for q in range(Q):
    s,t,x,y=input().split()
    s=int(s); t=int(t)
    x=float(x); y=float(y)

    p=conv(d[t],inv(d[s-1]))
    zeta=complex(x,y)
    eta=p[0]*zeta+p[1]
    print(eta.real,eta.imag)
0