結果

問題 No.1932 動く点 P / Moving Point P
ユーザー qibqib
提出日時 2023-03-17 01:01:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 3,673 ms / 6,000 ms
コード長 563 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 58,832 KB
最終ジャッジ日時 2024-09-18 09:41:59
合計ジャッジ時間 47,233 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import numpy as np

n = int(input())

s = []
s.append(np.identity(3, dtype=np.float64))
for _ in range(n):
  pi, qi, ri = map(float, input().split())
  theta = (2 * math.pi * ri) / 360
  ct = math.cos(theta)
  st = math.sin(theta)
  s.append(np.array([[ct, - st, - pi * ct + qi * st + pi], [st, ct, - pi * st - qi * ct + qi], [0, 0, 1.0]]) @ s[-1])

q = int(input())
for _ in range(q):
  sj, tj, xj, yj = input().split()
  m = s[int(tj)] @ np.linalg.inv(s[int(sj) - 1])
  v = m @ np.array([float(xj), float(yj), 1.0])
  print(f"{v[0]:.6f} {v[1]:.6f}")
0