結果
| 問題 |
No.760 Where am I moved to?
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 20:47:39 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 2,000 ms |
| コード長 | 1,499 bytes |
| コンパイル時間 | 144 ms |
| コンパイル使用メモリ | 82,404 KB |
| 実行使用メモリ | 54,256 KB |
| 最終ジャッジ日時 | 2025-03-20 20:47:54 |
| 合計ジャッジ時間 | 6,850 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
import math
def main():
import sys
input = sys.stdin.read().split()
idx = 0
xa = float(input[idx])
ya = float(input[idx+1])
theta_a_deg = float(input[idx+2])
idx +=3
x11 = float(input[idx])
y11 = float(input[idx+1])
idx +=2
x12 = float(input[idx])
y12 = float(input[idx+1])
idx +=2
x21 = float(input[idx])
y21 = float(input[idx+1])
idx +=2
x22 = float(input[idx])
y22 = float(input[idx+1])
idx +=2
# Step 1: compute a, b, dx, dy
a = x22 - x21
b = y22 - y21
dx = x12 - x11
dy = y12 - y11
# Step 2: compute denominator
denominator = a**2 + b**2
if abs(denominator) < 1e-9:
# This case is impossible per problem constraints
print("0 0 0")
return
# Step 3: compute cosD and sinD
cosD = (a*dx + b*dy) / denominator
sinD = (b*dx - a*dy) / denominator
# Step 4: compute D_rad
D_rad = math.atan2(sinD, cosD)
# Step 5: compute xb and yb using post1
xb = x11 - ( (x21 - xa) * cosD + (y21 - ya) * sinD )
yb = y11 + ( (x21 - xa) * sinD - (y21 - ya) * cosD )
# Compute theta_b
theta_a_rad = math.radians(theta_a_deg)
theta_b_rad = theta_a_rad - D_rad
theta_b_deg = math.degrees(theta_b_rad)
# Normalize theta_b_deg to [0, 360) if required, but per problem statement, it's optional
print(f"{xb:.10f} {yb:.10f} {theta_b_deg:.10f}")
if __name__ == "__main__":
main()
lam6er