Problem 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
3
1:00
01:01
00:00
 
Sample Output
13
0
12
这是一个水题,题意是输出几点,然后输出敲了几下,注意表是坏的,例如12点的时候是输出24。下面附上我过了的代码,希望对大家有帮助。

#include <stdio.h>
#include <stdlib.h>

int main()
{int t,a,b;
scanf("%d",&t);
while(t--)
{
scanf("%2d:%2d",&a,&b);
if(b!=0)
printf("0\n");
if(b==0)
{
if(a<=12)
printf("%d\n",a+12);
if(a>12)
printf("%d\n",a-12);
}

}

return 0;
}

Big Clock的更多相关文章

  1. 修改Linux系统日期与时间date clock

    先设置日期 date -s 20080103 再设置时间 date -s 18:24:30 为了永久生效,需要将修改的时间写入CMOS. 查看CMOS的时间: #clock -r 将当前系统时间写到C ...

  2. 操作系统页面置换算法(opt,lru,fifo,clock)实现

    选择调出页面的算法就称为页面置换算法.好的页面置换算法应有较低的页面更换频率,也就是说,应将以后不会再访问或者以后较长时间内不会再访问的页面先调出. 常见的置换算法有以下四种(以下来自操作系统课本). ...

  3. Cesium应用篇:3控件(1)Clock

    创建 跟Clock相关的主要有Animation控件和Timeline控件,通常两者会放在一起使用. 在Cesium中,Viewer默认开启这两个控件,如果你想要不显示控件,可以在Viewer初始化中 ...

  4. get back to the slower clock rate that allows it to save more power

    http://www.howtogeek.com/177790/why-you-cant-use-cpu-clock-speed-to-compare-computer-performance/ Wh ...

  5. Clock rate

    https://en.wikipedia.org/wiki/Clock_rate The clock rate typically refers to the frequency at which a ...

  6. clock()、time()、clock_gettime()和gettimeofday()函数的用法和区别【转】

    转自:http://www.cnblogs.com/krythur/archive/2013/02/25/2932647.html 转自http://blog.sina.com.cn/s/blog_7 ...

  7. 最少clock

    var elClock = document.getElementById("clock");var getTime = function(){ var _ = ['00','01 ...

  8. 用clock()函数计算多项式的运行时间

    百度百科中定义clock():clock()是C/C++中的计时函数,而与其相关的数据类型是clock_t.在MSDN中,查得对clock函数定义如下: clock_t clock(void) ; 简 ...

  9. 编写Java应用程序。首先,定义一个时钟类——Clock,它包括三个int型 成员变量分别表示时、分、秒,一个构造方法用于对三个成员变量(时、分、秒) 进行初始化,还有一个成员方法show()用于显示时钟对象的时间。其次,再定义 一个主类——TestClass,在主类的main方法中创建多个时钟类的对象,使用这 些对象调用方法show()来显示时钟的时间。

    package com.hanqi.test; public class Clock { int hh; int mm; int ss; String time; Clock(int h,int m, ...

  10. Clock Skew , Clock Uncertainty和 Period

    本文将介绍FPGA中和时钟有关的相关概念,阅读本文前需要对时序收敛的基本概念和建立.保持关系有一定了解,这些内容可以在时序收敛:基本概念,建立时间和保持时间(setup time 和 hold tim ...

随机推荐

  1. !! python 之半年总结

    http://blog.chinaunix.net/uid-26443921-id-3481357.html 半年前开始系统完整深入的了解学习 python 读书篇: <python 核心编程2 ...

  2. tlplayer for ios V1.1.2加密测试版本(修复1.1.1版本 for ios7播放闪退问题)

    此版本主要修复了ios7播放列表导致的程序闪退问题,方便大家测试加密与非加密视频. 此为tlplayer for ios版本,可以播放加密视频与非加密视频. 加密视频下载地址:http://blog. ...

  3. 实现简单的WebPart

    转:http://www.cnblogs.com/gaoweipeng/archive/2009/10/26/1589269.html 在前面的文章中,我们讲解了很多基础的内容,主要包括安装配置.简单 ...

  4. [Bhatia.Matrix Analysis.Solutions to Exercises and Problems]Contents

    I find it may cost me so much time in doing such solutions to exercises and problems....I am sorry t ...

  5. 分享form表单提交问题

    前段时间做了一个form表单传值问题  当时觉得form表单的submit不就是提交form表单name的value值吗 ? 其实是对的  但是我做的是一个打印页面  需要把当前页面的元素传入下一个u ...

  6. Android完全退出应用程序,完美解决方案

    最近公司工作不是很忙,就抽空研究了下Android的引导页,但是在写完引导页并且进入到住页面之后,在退出时,采用"再按一次退出"的方式去实现的,用的方式是杀掉进程跟exit,即:a ...

  7. NOIP 2013 花匠

    有多种方案,找拐点数目最简单O(n) 注意此题有相邻点价值一样,代码改变一点 #include <cstdio> #include<iostream> #include< ...

  8. chmod chgrp chown

    Linux系统中的每个文件和目录都有访问许可权限,用它来确定谁可以通过何种方式对文件和目录进行访问和操作. 文件或目录的访问权限分为只读,只写和可执行三种.以文件为例,只读权限表示只允许读其内容,而禁 ...

  9. org.apache.hadoop.hbase.TableNotDisabledException 解决方法

    Exception in thread "main" org.apache.hadoop.hbase.TableNotDisabledException: org.apache.h ...

  10. Nyoj42 一笔画问题 (欧拉道路)

    http://acm.nyist.net/JudgeOnline/problem.php?pid=42题目链接 #include <cstdio> #include <cstring ...