Poj 2840 Big Clock
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:00Sample Output
13
0
12Source
POJ Monthly--2006.06.25, Lei Tao
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的更多相关文章
- POJ 2840
#include<iostream> #include<stdio.h> #include<string> using namespace std; int mai ...
- 算法之路 level 01 problem set
2992.357000 1000 A+B Problem1214.840000 1002 487-32791070.603000 1004 Financial Management880.192000 ...
- POJ 3080 后缀数组/KMP
题目链接:http://poj.org/problem?id=3080 题意:给定n个DNA串,求最长公共子串.如果最长公共子串的长度小于3时输出no significant commonalitie ...
- POJ 3450 后缀数组/KMP
题目链接:http://poj.org/problem?id=3450 题意:给定n个字符串,求n个字符串的最长公共子串,无解输出IDENTITY LOST,否则最长的公共子串.有多组解时输出字典序最 ...
- POJ 1226 后缀数组
题目链接:http://poj.org/problem?id=1226 题意:给定n个字符串[只含大小写字母],求一个字符串要求在n个串或者他们翻转后的串的出现过.输出满足要求的字符串的长度 思路:根 ...
- POJ 3294 后缀数组
题目链接:http://poj.org/problem?id=3294 题意:给定n个字符串,求一个最长子串要求在超过一半的字符串中出现过. 如果多解按字典序输出 思路:根据<<后缀数组— ...
- POJ 2774 后缀数组
题目链接:http://poj.org/problem?id=2774 题意:给定两个只含小写字母的字符串,求字符串的最长公共子串长度. 思路:根据<<后缀数组——处理字符串的有力工具&g ...
- POJ 3693 后缀数组
题目链接:http://poj.org/problem?id=3693 题意:首先定义了一个字符串的重复度.即一个字符串由一个子串重复k次构成.那么最大的k即是该字符串的重复度.现在给定一个长度为n的 ...
- POJ 2406 KMP/后缀数组
题目链接:http://poj.org/problem?id=2406 题意:给定一个字符串,求由一个子串循环n次后可得到原串,输出n[即输出字符串的最大循环次数] 思路一:KMP求最小循环机,然后就 ...
随机推荐
- exe文件当前目录搜索文件
方法: //std::string dir = "C:\\Users\\xzd\\Documents\\KinectFile\\2014-09-07\\Select\\mengyue\\&q ...
- HDU 4293 Groups (线性dp)
OJ题目:click here~~ 题目分析:n个人分为若干组 , 每一个人描写叙述其所在的组前面的人数和后面的人数.求这n个描写叙述中,最多正确的个数. 设dp[ i ] 为前i个人的描写叙述中最多 ...
- [AngularJS] Directive with Transcluded Elements
Create a wrapWith directive using advanced transclusion techniques. transclude - compile the content ...
- NSRange,判断字符串的各种操作~
今天写的都比较简单,偶尔偷一下懒,猪真的很懒啊~ - (void)viewDidLoad { [super viewDidLoad]; //抽取指定范围的字符串 NSString *string1 ...
- Cobra —— 可视化Python虚拟机 and 图解python
http://blog.csdn.net/balabalamerobert http://blog.csdn.net/efeics/article/category/1486515 图解python ...
- laraval框架之数据库不可不吐槽的坑
最近做的项目一直在用laraval框架,有些地方确实很方便,但是有些方面实在是太坑了,就比如这次在数据库里,官方文档写的是 Take note that email is not a required ...
- Redis 连接
Redis 连接命令主要是用于连接 redis 服务. 实例 以下实例演示了客户端如何通过密码验证连接到 redis 服务,并检测服务是否在运行: redis 127.0.0.1:6379> ...
- 嵌入式系统 Boot Loader 技术内幕
转载:http://www.ibm.com/developerworks/cn/linux/l-btloader/index.html 1. 引言 在专用的嵌入式板子运行 GNU/Linux 系统 ...
- tar --help
pengdl@debian:~/test$ mkdir test1 pengdl@debian:~/test$ mkdir test2 pengdl@debian:~/test$ tar -xzf p ...
- 第一节:Maven 下载,安装和配置
Maven是Apache的一个产品所以要下载Maven的话可以到https://www.apache.org网站上下载 进入到APache这个网站后看一下几部操作 第一: 选择点击导航栏上面的proj ...