• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
HaibaraAi
博客园    首页    新随笔    联系   管理    订阅  订阅

Warm up 13 [H] Hours and Minutes

Hours and Minutes
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:65536KB
Total submit users: 44, Accepted users: 44

Problem 12755 : No special judgement

 

Problem description
Heidi has a discrete analog clock in the shape of a circle, as the one in the figure. Two hands rotate around the center of the circle, indicating hours and minutes. The clock has 60 marks placed around its perimeter, with the distance between consecutive marks being constant.
The minute hand moves from its current mark to the next exactly once every minute. The hour hand moves from its current mark to the next exactly once every 12 minutes, so it advances five marks each hour. We consider that both hands move discretely and instantly, which means they are always positioned exactly over one of the marks and never in between marks.
At midnight both hands reach simultaneously the top mark, which indicates zero hours and zero minutes. After exactly 12 hours or 720 minutes, both hands reach the same position again, and this process is repeated over and over again. Note that when the minute hand moves, the hour hand may not move; however, when the hour hand moves, the minute hand also moves.
Heidi likes geometry, and she likes to measure the minimum angle between the two hands of the clock at different times of the day. She has been writing some measures down, but after several years and a long list, she noticed that some angles were repeated while some others never appeared. For instance, Heidi's list indicates that both at three o'clock and at nine o'clock the minimum angle between the two hands is 90 degrees, while an angle of 65 degrees does not appear in the list. Heidi decided to check, for any integer number A between 0 and 180, if there exists at least one time of the day such that the minimum angle between the two hands of the clock is exactly A degrees. Help her with a program that answers this question.


Input
Each test case is described using one line. The line contains an integer A representing the angle to be checked (0 ≤ A ≤ 180).


Output
For each test case output a line containing a character. If there exists at least one time of the day such that the minimum angle between the two hands of the clock is exactly A degrees, then write the uppercase letter "Y". Otherwise write the uppercase letter "N".


Sample Input
90
65
66
67
128
0
180
Sample Output
Y
N
Y
N
N
Y
Y
Problem Source
Latin American 2012
 1 #pragma comment(linker, "/STACK:1024000000,1024000000")
 2 #include <map>
 3 #include <queue>
 4 #include <vector>
 5 #include <string>
 6 #include <cmath>
 7 #include <cstdio>
 8 #include <cstring>
 9 #include <iostream>
10 #include <algorithm>
11 using namespace std;
12 #define maxn 1000005
13 #define mod 1000000007
14 #define ll long long
15 #define INF 0x7fffffff
16 #define FF(i,n)for(int i=0;i<n;i++)
17 int n, m;
18 char s[maxn];
19 char str[maxn];
20 int p[maxn];
21 int fun(int x){
22     int a[5];
23     int i = 0;
24     while (x){
25         a[i++] = x % 10;
26         x /= 10;
27     }
28     for (int j = 0; j < i;j++)
29     for (int k = j+1; k < i;k++)
30     if (a[k] == a[j])return 0;
31     return 1;
32 }
33 int main(){
34     int cas = 1;
35     int t;
36     /*scanf("%d", &t);
37     while (t--){
38         
39     }*/
40     while (~scanf("%d", &n)){
41         t = 0;
42         int flag = 0;
43         for (int i = 0; i <= 360; i+=6){
44             if (i == n)flag = 1;
45         }
46         if(flag)printf("Y\n");
47         else printf("N\n");
48     }
49     return 0;
50 }
View Code

 

posted @ 2013-10-26 18:04  HaibaraAi  阅读(261)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3