結果
問題 |
No.1932 動く点 P / Moving Point P
|
ユーザー |
👑 ![]() |
提出日時 | 2022-05-07 02:38:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 468 ms / 6,000 ms |
コード長 | 738 bytes |
コンパイル時間 | 188 ms |
コンパイル使用メモリ | 82,188 KB |
実行使用メモリ | 107,608 KB |
最終ジャッジ日時 | 2024-07-06 06:24:37 |
合計ジャッジ時間 | 18,760 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 11 |
ソースコード
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 * import sys input=sys.stdin.readline write=sys.stdout.write 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()) Ans=[""]*Q for q in range(Q): s,t,x,y=input()[:-1].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] Ans[q]="{} {}".format(eta.real,eta.imag) write("\n".join(Ans))