結果

問題 No.760 Where am I moved to?
ユーザー cielciel
提出日時 2018-11-09 01:19:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 765 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,964 KB
実行使用メモリ 31,868 KB
最終ジャッジ日時 2023-09-09 05:51:17
合計ジャッジ時間 5,165 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
30,348 KB
testcase_01 AC 131 ms
30,032 KB
testcase_02 AC 130 ms
31,680 KB
testcase_03 AC 131 ms
30,204 KB
testcase_04 AC 133 ms
30,256 KB
testcase_05 AC 131 ms
30,344 KB
testcase_06 AC 129 ms
30,360 KB
testcase_07 AC 134 ms
31,736 KB
testcase_08 AC 129 ms
31,596 KB
testcase_09 AC 128 ms
31,868 KB
testcase_10 AC 127 ms
30,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
import sys,math,numpy
def thirdPoint(a):
	xdiff=a[1][0]-a[0][0]
	ydiff=a[1][1]-a[0][1]
	return [a[1][0]-ydiff,a[1][1]+xdiff]

xa,ya,ta=map(float,sys.stdin.readline().split())
ta*=math.pi/180
before_=[]
for _ in range(2): before_.append(list(map(float,sys.stdin.readline().split()))+[1])
before_.append(thirdPoint(before_)+[1])
before=numpy.array(before_).transpose()
after_=[]
for _ in range(2): after_.append(list(map(float,sys.stdin.readline().split()))+[1])
after_.append(thirdPoint(after_)+[1])
after=numpy.array(after_).transpose()
r=before.dot(numpy.linalg.inv(after)).dot([[math.cos(ta),-math.sin(ta),xa],[math.sin(ta),math.cos(ta),ya],[0,0,1]])
print(' '.join('%.12f'%e for e in [r[0][2],r[1][2],math.atan2(r[1][0],r[0][0])*180/math.pi]))
0