CF630M.Turn

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vasya started working in a machine vision company of IT City. Vasya's team creates software and hardware for identification of people by their face.

One of the project's know-how is a camera rotating around its optical axis on shooting. People see an eye-catching gadget — a rotating camera — come up to it to see it better, look into it. And the camera takes their photo at that time. What could be better for high quality identification?

But not everything is so simple. The pictures from camera appear rotated too (on clockwise camera rotation frame the content becomes rotated counter-clockwise). But the identification algorithm can work only with faces that are just slightly deviated from vertical.

Vasya was entrusted to correct the situation — to rotate a captured image so that image would be minimally deviated from vertical. Requirements were severe. Firstly, the picture should be rotated only on angle divisible by 90 degrees to not lose a bit of information about the image. Secondly, the frames from the camera are so huge and FPS is so big that adequate rotation speed is provided by hardware FPGA solution only. And this solution can rotate only by 90 degrees clockwise. Of course, one can apply 90 degrees turn several times but for the sake of performance the number of turns should be minimized.

Help Vasya implement the program that by the given rotation angle of the camera can determine the minimum number of 90 degrees clockwise turns necessary to get a picture in which up direction deviation from vertical is minimum.

The next figure contains frames taken from an unrotated camera, then from rotated 90 degrees clockwise, then from rotated 90 degrees counter-clockwise. Arrows show direction to "true up".

The next figure shows 90 degrees clockwise turn by FPGA hardware.

输入格式

The only line of the input contains one integer xx ( 1018<=x<=1018-10^{18}<=x<=10^{18} ) — camera angle in degrees. Positive value denotes clockwise camera rotation, negative — counter-clockwise.

输出格式

Output one integer — the minimum required number of 90 degrees clockwise turns.

输入输出样例

  • 输入#1

    60
    

    输出#1

    1
    
  • 输入#2

    -60
    

    输出#2

    3
    

说明/提示

When the camera is rotated 6060 degrees counter-clockwise (the second example), an image from it is rotated 6060 degrees clockwise. One 9090 degrees clockwise turn of the image result in 150150 degrees clockwise total rotation and deviation from "true up" for one turn is 150150 degrees. Two 9090 degrees clockwise turns of the image result in 240240 degrees clockwise total rotation and deviation from "true up" for two turns is 120120 degrees because 240240 degrees clockwise equal to 120120 degrees counter-clockwise. Three 9090 degrees clockwise turns of the image result in 330330 degrees clockwise total rotation and deviation from "true up" for three turns is 3030 degrees because 330330 degrees clockwise equal to 3030 degrees counter-clockwise.

From 6060 , 150150 , 120120 and 3030 degrees deviations the smallest is 3030 , and it it achieved in three 9090 degrees clockwise turns.

首页