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求最小循环机,然后就 ...
随机推荐
- 使用sql生成UUID
在SQLServer中使用该sql语句可以生成GUID:select cast(NEWID() as varchar(36)) as uuid 通过一下语句将GUID中的'-'字符去掉: select ...
- javaio学习笔记-字符流类(1)
1.java.io包中的字符流类-BufferedReader和BufferedWriter: BufferedReader:缓存的输入字符流; BufferedWriter:缓存的输出字符流; In ...
- DataPackage-数据库、表的区域设置和系统不一致导致处理失败
问题描述: 最近学习Datapackage,创建完之后,部署处理但总是提示某某字段的区域设置和目标字段的区域设置不一致,具体如图: 测试发现其它的数据库表又没有这类 ...
- Team Queue
Team Queue Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 2471 Accepted: 926 Descrip ...
- myeclipse2014如何添加源码反编译工具插件
Eclipse下的Java反编译插件:Eclipse Class Decompiler,整合了目前最好的2个Java反编译工具Jad和JD-Core,并且和Eclipse Class Viewer无缝 ...
- struts2.1笔记06:struts2开发环境的搭建实际操作出现的问题
1.我根据新建一个struts工程之后,启动报错,如下: 六月 29, 2015 3:08:18 下午 org.apache.catalina.core.AprLifecycleListener in ...
- ArcGIS: version not specified. You must call RuntimeManager.Bind before creat
打开program.cs把ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);这句放到Applicatio ...
- swift基本数据类型的使用
// // ViewController.swift // 基本数据类型 // // Created by 叶炯 on 16/9/8. // Copyright © 2016年 叶炯. All rig ...
- 查看Oracle执行计划的几种方法
查看Oracle执行计划的几种方法 一.通过PL/SQL Dev工具 1.直接File->New->Explain Plan Window,在窗口中执行sql可以查看计划结果.其中,Cos ...
- Linux下文件的三个时间(Atime,Mtime,Ctime)
文件的三个时间 我们已经很熟悉windows系统了,那么我们在windows下新建一个文件,我们知道它在保存的时候肯定是会保存一下文件的创建时间之类的信息的,那么我们来看看windows下的一个文件保 ...