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求最小循环机,然后就 ...
随机推荐
- iOS开发——实用篇Swift篇&QQ登入界面实现
QQ登入界面实现 我们知道在App Store中几乎所有软件都设计到账户的登入,而我们最常见的就是QQ,微信,在没有踏入程序员这条不归路之前,看到一个个的界面都感觉好高大上的样子. 在学习的过程中,自 ...
- 基础笔记(二)HTTP协议
GET与POST的区别 1.GET提交的数据会放在URL之后,以?分割URL和传输数据,参数之间用&连接:POST是把提交的数据放在HTTP的body中. 2.GET提交的数据大小有限制(协议 ...
- 使用asp.net动态添加html元素
HtmlGenericControl gen = new HtmlGenericControl("div"); gen.InnerText = "HtmlG ...
- Helpers\Pagination
Helpers\Pagination Break recordset into a series of pages. First create a new instance of the class ...
- Eclipse launch failed.Binary not found解决方案
配置完成后建立工程测试,发现建立Hello World c++ Project类型的项目后可以运行测试,直接建立空项目写个测试类无法运行,提示"launch failed.Binary no ...
- Asp.Net 之 使用Form认证实现用户登录 (LoginView的使用)
1. 创建一个WebSite,新建一个页面命名为SignIn.aspx,然后在页面中添加如下的代码 <div class="div_logView"> <asp: ...
- How to update FVDI Commander driver to latest V2015.6.2
As FVDI Commander products are upgraded to new versions, I often receive emails from customers askin ...
- Advanced Installer
Advanced Installer是一款功能强大.可生成符合 MS Windows 认证的 Windows Installer 的 MSI 安装包制作工具,具有友好的图形用户界面,直观而且非常简单的 ...
- SQL Server2008附加数据库失败
今天旁晚时分,我准备把老师在上课时候发给我们的一个数据库附加到我的SQL Server2008上面去,本来在学校机房用的SQL Server2000是很顺利地就成功了,但是把*.mdf文件附加到我的0 ...
- mysql开启外联方法
1.修改Mysql配置文件 /etc/mysql/my.cnf 注释掉 bind-address = 127.0.0.1 2.重启Mysql /etc/init.d/mysql restart 3.r ...