博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
POJ 2840 Big Clock(我的水题之路——水,钟)
阅读量:4069 次
发布时间:2019-05-25

本文共 1553 字,大约阅读时间需要 5 分钟。

Big Clock
Time Limit: 1000MS   Memory Limit: 131072K
Total Submissions: 7912   Accepted: 5024

Description

Our vicar raised money to have the church clock repaired for several weeks. The big clock, which used to strike the hours days and nights, was damaged several weeks ago and had been silent since then. 
After the clock was repaired, it works all right, but there is still something wrong with it: the clock will strike thirteen times at one o’clock, fourteen times at two o’clock... 24 times at 12:00, 1 time at 13:00... 
How many times will it strike now? 

Input

The first line consists of only one integer T (T <= 30), representing the number of test cases. Then T cases follow. 
Each test case consists of only one line, representing the time now. Each line includes 2 integers H, M separated by a symbol ":". (0 <= H < 24, 0 <= M < 60) 

Output

For each test case, output the answer in one line.

Sample Input

31:0001:0100:00

Sample Output

13012

Source

, Lei Tao
一个钟坏了,0:00敲12下,1:00敲13下,2:00敲14下……11:00敲23下,12:00敲24下,13:00敲1下,14:00敲2下……。不是整点的时间不敲钟输出0.其他时间,输出对应敲击的次数。
除了12点以外,i点的时候敲击(12+i)%24下,非整点,敲击0下。
代码(1AC):
#include 
#include
#include
int main(void){ int ii, casenum; int h, m; scanf("%d", &casenum); for (ii = 0; ii < casenum; ii++){ scanf("%d:%d", &h, &m); if (m == 0){ if (h == 12){ printf("24\n"); } else{ printf("%d\n", (12 + h) % 24); } } else{ printf("0\n"); } } return 0;}

转载地址:http://kloji.baihongyu.com/

你可能感兴趣的文章
IA32时钟周期的一些内容
查看>>
SM2椭圆曲线公钥密码算法
查看>>
获得github工程中的一个文件夹的方法
查看>>
《PostgreSQL技术内幕:查询优化深度探索》养成记
查看>>
PostgreSQL查询优化器详解之逻辑优化篇
查看>>
STM32中assert_param的使用
查看>>
C语言中的 (void*)0 与 (void)0
查看>>
vu 是什么
查看>>
io口的作用
查看>>
IO口的作用
查看>>
UIView的使用setNeedsDisplay
查看>>
归档与解归档
查看>>
Window
查看>>
为什么button在设置标题时要用一个方法,而不像lable一样直接用一个属性
查看>>
字符串的截取
查看>>
2. Add Two Numbers
查看>>
17. Letter Combinations of a Phone Number (DFS, String)
查看>>
93. Restore IP Addresses (DFS, String)
查看>>
19. Remove Nth Node From End of List (双指针)
查看>>
49. Group Anagrams (String, Map)
查看>>