Rotation Transformation

시간 제한2초메모리 제한1024 MB

요약
3x3 회전 행렬이 주어질 때 회전각을 도 단위로, 그리고 단위 회전축 벡터를 복원하는 문제다.
난이도

보통10점 중 7점

유형
수학, 기하, 행렬, 구현
정답자
아직 제출이 없습니다

문제

A simple motion over and over...


t.A.T.u., <<A Simple Motion>>

Julia loves simple motions very much especially in three-dimensional space! Recently she found a matrix that corresponds with some rotation around an axis that goes through the origin. Rotation is defined by unit vector v=(v_x v_y v_z)v = \begin{pmatrix} v\_x \\\ v\_y \\\ v\_z \end{pmatrix} and rotation angle α\alpha.

Suppose you look at the origin from the end of vv then if rotation is going counter-clockwise then α\alpha will be positive, negative overwise.

Rotation matrix moves point (x y z)\begin{pmatrix} x \\\ y \\\ z \end{pmatrix} to (x′ y′ z′)\begin{pmatrix} x' \\\ y' \\\ z' \end{pmatrix} like this: (x′ y′ z′)=(A_11A_12A_13 A_21A_22A_23 A_31A_32A_33 )×(x y z).\begin{pmatrix} x' \\\ y' \\\ z' \end{pmatrix} = \begin{pmatrix} A\_{11} & A\_{12} & A\_{13} \\\ A\_{21} & A\_{22} & A\_{23} \\\ A\_{31} & A\_{32} & A\_{33} \\\ \end{pmatrix} \times \begin{pmatrix} x \\\ y \\\ z \end{pmatrix}.

Unfortunately Julia doesn't know values of vv and α\alpha, so she asked you to restore them and then she will continue her simple motion.

입력

You are given matrix AA. It is guaranteed that there is such rotation matrix A′A' that ∣A′_ij−A_ij∣<10−13|A'\_{ij} - A\_{ij}| < 10^{-13}.

출력

First line should contain α\alpha in degrees. Second line should contain coordinates of unit vector vv. It is guaranteed that 1≤∣α∣≤1791 \le |\alpha| \le 179. Output all number as precise as you can. Your answer will be considered correct if the difference between A_ijA\_{ij} and the matrix constructed from your angle and unit vector will not exceed 10−610^{-6}.

예제1

  1. 예제 1

    입력
    0 -1 0
    1 0 0
    0 0 1
    
    예상 출력
    90
    0 0 1