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. Arch linux安装

    安装archlinux可参考: http://blog.sina.com.cn/s/blog_69e5d8400101bqlj.html http://www.cnblogs.com/mad/p/32 ...

  2. SharePoint Site Pages & Application Pages

    转:http://www.wcode.net/plus/view.php?aid=1582071 SharePoint一个很重要的概念就是Site Pages和Application Pages.接触 ...

  3. C#读取设置Cookie

    设置: HttpCookie cookie = new HttpCookie("cookieName"); cookie.Value = "name1" Htt ...

  4. JavaScript window.location对象

    JavaScript window.location对象   示例 注意 方法 经常使用window.location,它的结构总是记不住,简单梳理下,方便以后查询. 示例 URL:http://b. ...

  5. Linux使用sudo提权时,出现xx 不在 sudoers 文件中。此事将被报告。visudo 命令简单介绍。

    在使用 sudo 临时提权时,出现:不在 sudoers 文件中.此事将被报告. 可以使用 visudo命令 来配置/etc/sudoers文件,将目标用户赋予使用sudo命令的能力. visudo命 ...

  6. 【原】spark-submit提交应用程序的内部流程

    我们经常通过spark-submit来提交spark应用程序,那么让我们一起看一下这里面到底发生了什么吧. 知识点: 1.CLI命令行界面启动Spark应用程序 Unix有两种方式:1)spark-s ...

  7. Git 远程分支的查看及相关问题

    命令:git ls-remote -t 或者 git ls-remote --tag 运行结果如下: 0975ebc0f9a6b42ecbe066a50a26a678a0753b4d refs/tag ...

  8. shell脚本应用(2)--变量,数值和字符串

    变量 定义,赋值: var=value 引用 $var,${var} 特殊变量 $?上条命令状态 $*/$@所有参数列表 $#参数个数 $0执行的命令名称 $1/${10}第1/10个参数 数值运算 ...

  9. (Step by Step)How to setup IP Phone Server(VoIP Server) for free.

    You must have heard about IP Phone and SIP (Software IP Phone).Nowadays standard PSTN phone are bein ...

  10. 问题-[WIN8.132位系统]安装Win8.1 遇到无法升级.NET Framework 3.5.1

    问题现象:安装Win8后都遇到了无法升级.NET Framework 3.5.1的问题,在线升级会遇到错误0x800F0906.这使得91手机助手等很多软件无法运行,更郁闷的是,网上几乎所有的解决办法 ...