FZU 1783 Strange Clock
2009-08-03 17:10
183 查看
Strange Clock
解题:
一开始依旧被表给晕了。注意看图。上面的数字就是时间。90度为0点,60度为1点,0度为3点,330度为4点···
Time Limit:1s | Memory limit:32M |
Accepted Submit:44 | Total Submit:92 |
Problem DescriptionThere is a strange clock, without any number written. Can you tell me what time it is now, based on the angle of the hour hand?When the hour hand points right (0 degree), it is 3 o’clock. When it points to 80 degrees, it’s between 0 o’clock and 1 o’clock. Note that there is no 12 o’clock. You should always write 0 o’clock instead. InputThere are at most 10 test cases. Each case contains a single integer a (0 ≤ a < 360), the angle of the hour hand. The input ends with a = -1.OutPutFor each test case, print the current time, in one of the following format: - Exactly x o’clock - Between x o’clock and y o’clock Note that, in the second format, x o’clock should be exactly one hour before y o’clock, So you cannot write something like “Between 3 o’clock and 2 o’clock”.Sample Input90 245 -1 Sample OutputExactly 0 o'clock Between 6 o'clock and 7 o'clock Original: 2009 NIT Cup National Invitation Contest |
一开始依旧被表给晕了。注意看图。上面的数字就是时间。90度为0点,60度为1点,0度为3点,330度为4点···
#include <iostream> using namespace std; int main() { int n,i,j; int degrees[13]={90,60,30,0,330,300,270,240,210,180,150,120,90}; while (cin>>n && n!=-1) { if (n%30==0) { for (i=0;i<12;i++) { if (degrees[i]==n) { cout<<"Exactly "<<i<<" o'clock"<<endl; break; } } } else { for (i=0;i<12;i++) { if (degrees[i]>n && degrees[i+1]<n) { cout<<"Between "<<i<<" o'clock and "; if (i+1==12) { i=-1; } cout<<i+1<<" o'clock"<<endl; break; } } } } return 0; }
相关文章推荐
- FZU-2105 Digits Count(线段树)
- FZU/FOJ 2243 Daxia like uber【最短路SPFA+思维】
- FZU Problem 2213 Common Tangents(简单几何,分类讨论)——第六届福建省大学生程序设计竞赛-重现赛
- FZU 2221 RunningMan
- FZU - 1570 集合划分问题 (Stirling数)
- fzu 2020 组合数取模
- 【FZU2020】【Lucas模板题】【求组合数取模】
- FZU 1683 纪念SlingShot (简单的矩阵快速幂)
- FZU 2020 组合数取模(Lucas定理模版)
- FZU 2218 Simple String Problem
- FZU 1977 Pandora adventure
- Fzu 2116 买糖果【二维费用背包】
- FZU1082-最大黑区域
- FZU 1683 矩阵构造
- FZU 1036 四塔问题
- FZU Fire Game(两点BFS)
- FZU Fire Game(两点BFS)
- FZU-1082(DFS)
- fzu 防守阵地 1
- FZU 1889 龟兔赛跑