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求最小循环机,然后就 ...
随机推荐
- Codeforces 278C Learning Languages(并查集)
题意抽象出来就是求联通块的个数吧,然后添加最少边使图联通. 注意所有人都不会任何语言的时候,答案是n而不是n-1. #include<algorithm> #include<iost ...
- [Jest] Test JavaScript with Jest
Let's learn how to unit test your JavaScript with Jest, a JavaScript unit testing framework from Fac ...
- Ruby on Rails Tutorial 第四章 Rails背后的Ruby 之 类
Ruby和其他面向对象的语言一样,使用类来组织方法,然后实例化类,创建对象.1.构造方法使用双引号是字符串的字面构造方法,也可以使用“具名构造方法”,即在类名上调用new方法 >> s=& ...
- 简化LINUX的命令输入 简化linux命令
在LINUX中,有很多常用的命令,常用的命令我们可以熟练的记忆,但是对于不经常使用的命令恐怕是需要翻阅手册了,但是我们可以简化这些命令的输入来达到简便记忆的效果. 这里以BSH为例: 编辑/etc/b ...
- Java_InvokeAll_又返回值_多个线程同时执行,取消超时线程
package com.demo.test4; import java.util.ArrayList; import java.util.List; import java.util.concurre ...
- CentOS 安装中文输入法
转载:http://blog.sina.com.cn/s/blog_9f1c093101019h03.html centos 6.3用yum安装中文输入法 1.需要root权限,所以要用root登录 ...
- Centos 安装KScope1.6.2
准备工作:安装ctags graphviz,和cscope (可以用yum install来安装) 1.首先下载kscope,最好下载16.x的版本,这个最好的 下载kscope-1.6.2.tar ...
- 使用GPS经纬度定位附近地点(某一点范围内查询)
需要手机查找附近N米以内的商户,致想法是已知一个中心点,一个半径,求圆包含于圆抛物线里所有的点,经纬度是一个点,半径是一个距离,不能直接加减,下面提供C#的解决方法 数据库中记录了商家在百度标注的经纬 ...
- XML 之 与Json或String的相互转换
1.XML与String的相互转换 [1] XML 转为 String //载入Xml文件 XmlDocument xdoc = new XmlDocument(); xdoc.Load(" ...
- B. Little Dima and Equation
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...