303250: CF630M. Turn

Memory Limit:64 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Turn

题意翻译

Vasya开始在某城的机器视觉公司工作。Vasya 的团队开发了通过脸部识别人的软件和硬件。这个项目的诀窍之一就是在拍摄时摄像机绕着光轴旋转。人们看到一个引人注目的小玩意ーー一个旋转的照相机ーー走到它面前,以便更好地观察它,观察它。照相机拍下了他们的照片。还有什么能更好地进行高质量的鉴定呢? 但不是每件事都这么简单。来自相机的图片也出现了旋转(在顺时针相机旋转框架内容成为逆时针旋转)。但是这种识别算法只适用于略微偏离垂直方向的人脸。 vasya 负责纠正这种情况ーー旋转捕捉到的图像,使图像与垂直方向的偏差微乎其微。要求很严格。首先,图片应该只旋转角度可分为90度,不失去一点点的信息,图像。其次,由于摄像机的帧数太大,帧数太大,只有硬件 fpga 解决方案才能提供足够的旋转速度。这种溶液只能顺时针旋转90度。当然,一个人可以使用90度旋转几次,但为了性能起见,旋转的次数应该是最少的。帮助 vasya 实现这个程序,根据给定的相机旋转角度,可以确定90度顺时针旋转的最小次数,从而得到一张垂直方向偏离最小的图片。箭头指向“ true up”。 ![abc](https://cdn.luogu.com.cn/upload/vjudge_pic/CF630M/0a70d06294ba14cf6932d88e73f7104a80a47ffd.png)下图显示了 fpga 硬件90度顺时针旋转。 ![bcd](https://cdn.luogu.com.cn/upload/vjudge_pic/CF630M/27415d2b40a093696eff613b76f89792e0d969f3.png) ### 输入格式 输入的唯一一行包含一个整数 x (- 10 ^ 18 < = x < = 10 ^ 18)ー摄像机角度度数。正值表示照相机顺时针旋转,负值表示逆时针旋转。 ### 输出格式 输出一个整数——时针旋转90度所需的最少次数。

题目描述

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". ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF630M/0a70d06294ba14cf6932d88e73f7104a80a47ffd.png)The next figure shows 90 degrees clockwise turn by FPGA hardware. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF630M/27415d2b40a093696eff613b76f89792e0d969f3.png)

输入输出格式

输入格式


The only line of the input contains one integer $ x $ ( $ -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 $ 60 $ degrees counter-clockwise (the second example), an image from it is rotated $ 60 $ degrees clockwise. One $ 90 $ degrees clockwise turn of the image result in $ 150 $ degrees clockwise total rotation and deviation from "true up" for one turn is $ 150 $ degrees. Two $ 90 $ degrees clockwise turns of the image result in $ 240 $ degrees clockwise total rotation and deviation from "true up" for two turns is $ 120 $ degrees because $ 240 $ degrees clockwise equal to $ 120 $ degrees counter-clockwise. Three $ 90 $ degrees clockwise turns of the image result in $ 330 $ degrees clockwise total rotation and deviation from "true up" for three turns is $ 30 $ degrees because $ 330 $ degrees clockwise equal to $ 30 $ degrees counter-clockwise. From $ 60 $ , $ 150 $ , $ 120 $ and $ 30 $ degrees deviations the smallest is $ 30 $ , and it it achieved in three $ 90 $ degrees clockwise turns.

Input

题意翻译

Vasya开始在某城的机器视觉公司工作。Vasya 的团队开发了通过脸部识别人的软件和硬件。这个项目的诀窍之一就是在拍摄时摄像机绕着光轴旋转。人们看到一个引人注目的小玩意ーー一个旋转的照相机ーー走到它面前,以便更好地观察它,观察它。照相机拍下了他们的照片。还有什么能更好地进行高质量的鉴定呢? 但不是每件事都这么简单。来自相机的图片也出现了旋转(在顺时针相机旋转框架内容成为逆时针旋转)。但是这种识别算法只适用于略微偏离垂直方向的人脸。 vasya 负责纠正这种情况ーー旋转捕捉到的图像,使图像与垂直方向的偏差微乎其微。要求很严格。首先,图片应该只旋转角度可分为90度,不失去一点点的信息,图像。其次,由于摄像机的帧数太大,帧数太大,只有硬件 fpga 解决方案才能提供足够的旋转速度。这种溶液只能顺时针旋转90度。当然,一个人可以使用90度旋转几次,但为了性能起见,旋转的次数应该是最少的。帮助 vasya 实现这个程序,根据给定的相机旋转角度,可以确定90度顺时针旋转的最小次数,从而得到一张垂直方向偏离最小的图片。箭头指向“ true up”。 ![abc](https://cdn.luogu.com.cn/upload/vjudge_pic/CF630M/0a70d06294ba14cf6932d88e73f7104a80a47ffd.png)下图显示了 fpga 硬件90度顺时针旋转。 ![bcd](https://cdn.luogu.com.cn/upload/vjudge_pic/CF630M/27415d2b40a093696eff613b76f89792e0d969f3.png) ### 输入格式 输入的唯一一行包含一个整数 x (- 10 ^ 18 < = x < = 10 ^ 18)ー摄像机角度度数。正值表示照相机顺时针旋转,负值表示逆时针旋转。 ### 输出格式 输出一个整数——时针旋转90度所需的最少次数。

加入题单

算法标签: