HDU 5705(思路题)
来源:互联网 发布:社团团徽设计软件 编辑:程序博客网 时间:2024/06/09 23:18
Clock
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 517 Accepted Submission(s): 180
Problem Description
Given a time HH:MM:SS and one parameter a , you need to calculate next time satisfying following conditions:
1. The angle formed by the hour hand and the minute hand isa .
2. The time may not be a integer(e.g. 12:34:56.78), rounded down(the previous example 12:34:56).
1. The angle formed by the hour hand and the minute hand is
2. The time may not be a integer(e.g. 12:34:56.78), rounded down(the previous example 12:34:56).
Input
The input contains multiple test cases.
Each test case contains two lines.
The first line is the time HH:MM:SS(0≤HH<12,0≤MM<60,0≤SS<60) .
The second line contains one integera(0≤a≤180) .
Each test case contains two lines.
The first line is the time HH:MM:SS
The second line contains one integer
Output
For each test case, output a single line contains test case number and the answer HH:MM:SS.
Sample Input
0:59:593001:00:0030
Sample Output
Case #1: 01:00:00Case #2: 01:10:54
Source
"巴卡斯杯" 中国大学生程序设计竞赛 - 女生专场
Recommend
liuyiding | We have carefully selected several similar problems for you: 5775 5774 5773 5772 5771
首先知道时针120秒走1度,分针10秒走一度。故120秒分针和时针相差11度,所以相差一度需要120/11秒,考虑到精度可以让所有的数据乘以11变成整数。时间从120秒开始枚举,直到满足条件结束, 由于前面乘以了11,结果需要除以11.
#include<cstdio>#include<cmath>int main(){ int hh, mm, ss, kase = 0; while(scanf("%d:%d:%d", &hh, &mm, &ss) == 3){ int a; scanf("%d", &a); int t = hh * 3600 + mm * 60 + ss; t *= 11; a *= 11; int i; int tt = 0, ttt = 0; for(i = 120; ; i += 120){ tt += 11; if(tt > 360 * 11) ttt = tt % (11 * 360); else ttt = tt; if(ttt > 180 * 11) ttt = 360 * 11 - ttt; if(ttt == a && i > t) break; } i %= 43200 * 11; int h = i / (3600 * 11 ); int m = (i - h * (3600 * 11)) / (60 * 11); int s = (i - h * (3600 * 11) - m * (60 * 11)) / 11; if(h == 24) h = 0; printf("Case #%d: %02d:%02d:%02d\n", ++kase, h, m, s); }}
1 0
- HDU 5705(思路题)
- HDU 5750 Dertouzos(思路题)
- HDU 6029 Graph Theory(思路题)
- HDU 4970 思路题
- HDU 5301 思路题
- HDU--5281(思路)
- [思路题] hdu 5124 lines
- HDU 5821 Ball 思路题
- HDU 5416(思路题目)
- HDU-5914 Triangle(思路)
- hdu 5416 CRB and Tree(异或,思路题)
- hdu 5805 NanoApe Loves Sequence(简单思路题)
- HDU 2819 Swap 二分匹配 (思路题)
- HDU 6069 Counting Divisors 思路题(附赠大神代码)
- HDU 1719 Friend (思路题)公式推导变形
- hdu 1846结题报告/思路
- hdu 4647 - Another Graph Game(思路题)
- [思路题] hdu 5288 OO’s Sequence
- tjut 4666
- HDU1075->Trie树
- java设计模式_观察者模式
- GZIP压缩原理分析(15)——第五章 Deflate算法详解(五06) 预备知识(05) 预备知识总结
- PyGobject(四十五)布局容器之Grid
- HDU 5705(思路题)
- Oracle 11g数据库安装及配置
- 静态内存分配-链表管理(1)单向量表讲解
- Android studio code template个性化设置
- POJ 2392 DP
- Just a Hook(就是一个 set(线段树))
- 选择排序
- Redhat下载地址
- Loadrunner结果文件太大打不开