1.Link:

http://poj.org/problem?id=2840

2.Content:

Big Clock
Time Limit: 1000MS   Memory Limit: 131072K
Total Submissions: 9735   Accepted: 6165

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

Source

3.Method:

4.Code:

 #include<iostream>
#include <cstdio> using namespace std; int main()
{
int i,n;
int a,b;
cin>>n;
for(i=;i<n;i++)
{
scanf("%d:%d",&a,&b);
if(b!=) cout<<<<endl;
else
{
if(a<=) cout<<(a+)<<endl;
else cout<<(a-)<<endl;
}
}
//system("pause");
return ;
}

5.Reference:

Poj 2840 Big Clock的更多相关文章

  1. POJ 2840

    #include<iostream> #include<stdio.h> #include<string> using namespace std; int mai ...

  2. 算法之路 level 01 problem set

    2992.357000 1000 A+B Problem1214.840000 1002 487-32791070.603000 1004 Financial Management880.192000 ...

  3. POJ 3080 后缀数组/KMP

    题目链接:http://poj.org/problem?id=3080 题意:给定n个DNA串,求最长公共子串.如果最长公共子串的长度小于3时输出no significant commonalitie ...

  4. POJ 3450 后缀数组/KMP

    题目链接:http://poj.org/problem?id=3450 题意:给定n个字符串,求n个字符串的最长公共子串,无解输出IDENTITY LOST,否则最长的公共子串.有多组解时输出字典序最 ...

  5. POJ 1226 后缀数组

    题目链接:http://poj.org/problem?id=1226 题意:给定n个字符串[只含大小写字母],求一个字符串要求在n个串或者他们翻转后的串的出现过.输出满足要求的字符串的长度 思路:根 ...

  6. POJ 3294 后缀数组

    题目链接:http://poj.org/problem?id=3294 题意:给定n个字符串,求一个最长子串要求在超过一半的字符串中出现过. 如果多解按字典序输出 思路:根据<<后缀数组— ...

  7. POJ 2774 后缀数组

    题目链接:http://poj.org/problem?id=2774 题意:给定两个只含小写字母的字符串,求字符串的最长公共子串长度. 思路:根据<<后缀数组——处理字符串的有力工具&g ...

  8. POJ 3693 后缀数组

    题目链接:http://poj.org/problem?id=3693 题意:首先定义了一个字符串的重复度.即一个字符串由一个子串重复k次构成.那么最大的k即是该字符串的重复度.现在给定一个长度为n的 ...

  9. POJ 2406 KMP/后缀数组

    题目链接:http://poj.org/problem?id=2406 题意:给定一个字符串,求由一个子串循环n次后可得到原串,输出n[即输出字符串的最大循环次数] 思路一:KMP求最小循环机,然后就 ...

随机推荐

  1. [Angular 2] Inject Service with "Providers"

    In this lesson, we’re going to take a look at how add a class to the providers property of a compone ...

  2. mysql 5.6 binlog组提交1

    [MySQL 5.6] MySQL 5.6 group commit 性能测试及内部实现流程   尽管Mariadb以及Facebook在long long time ago就fix掉了这个臭名昭著的 ...

  3. 如何通过VIM把代码格式化后生成HTML网页代码

    本文转自http://wangxiaoyu.blog.51cto.com/922065/203471 需求及思路:演示需要,需要网站上嵌入一些代码,我的建议做法是根据代码文件,生成相应的HTML代码, ...

  4. 进程间通信之popen和pclose函数

    常见的操作是创建一个管道连接到另一个进程,然后读其输出或向其输入端发送数据,为此,标准I/O库提供了两个函数popen和pclose.这两个函数实现的操作是:创建一个管道,调用fork产生一个子进程, ...

  5. 如何制作按钮hover状态

    1.选中文字加背景图层 2.Ctrl+J复制图层,向下轻移. 3.点击所复制图层的背景图层,右键选中——混合选项 弹出图层样式框: 4.选择渐变叠加,将渐变——反向勾选上,确定: 5.完成,效果如图.

  6. 琐碎-hadoop1.X和2.X的区别

    1.  jobtracker做了分离,分成了resourceManager和nodemanager: 2.  MR变成了和HBase和Hive等一样的yarn上面的一个应用: 3.  1.x的默认块大 ...

  7. Boxes in a Line

    Boxes in a Line You have n boxes in a line on the table numbered 1 . . . n from left to right. Your ...

  8. python(3)-集合

    集合就是把不同的元素组织在一起,但在集合中不允许有重复的元素. >>> a = set() #创建集合 >>> type(a) <class 'set'> ...

  9. [改善Java代码]减少HashMap中元素的数量

    在系统开发中我们经常会使用HashMap作为数据集容器,或者是用缓冲池来处理,一般很稳定,但偶尔也会出现内存溢出的问题(OutOfMemory错误),而且这经常是与HashMap有关的.而且这经常是与 ...

  10. sqlserver和oracle中对全半角的转换

    oracle中对全半角的转换 to_single_byte(c)转换成半角 to_multi_byte(c)转换成全角 SELECT To_single_byte('881898?71') FROM ...