HDOJ 5276 YJC tricks time multimap
multimap的使用
YJC tricks time
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/262144 K (Java/Others)
Total Submission(s): 492 Accepted Submission(s): 215

YJC is not a timelord so he can't trick time but the clock is so hard to read. So he'd like to trick you.
Now YJC gives you the angle between the hour hand and the minute hand, you'll tell him what time it is now.
You'll give him the possible time in the format:
HH:MM:SS
HH represents hour, MM represents minute, SS represents second.
(For example, 08:30:20)
We use twelve hour system, which means the time range is from 00:00:00 to 11:59:59.
Also, YJC doesn't want to be too accurate, one answer is considered acceptable if and only if SS mod 10 = 0 .
in one test.
for each case:
One integer x indicating
the angle, for convenience, x has
been multiplied by 12000.
(So you can read it as integer not float) In this case we use degree as the unit of the angle, and it's an inferior angle. Therefore, x will
not exceed 12000∗180=2160000.
T lines. T represents
the total number of answers of this case.
Output the possible answers in ascending order. (If you cannot find a legal answer, don't output anything in this case)
99000
0
00:01:30
11:58:30
00:00:00
/* ***********************************************
Author :CKboss
Created Time :2015年07月10日 星期五 08时55分44秒
File Name :HDOJ5276.cpp
************************************************ */ #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map> using namespace std; struct Time
{
int hh,mm,ss;
}; multimap<int,Time> mt; /// every 10 second
/// s: 720000 m: 12000 h: 1000 const int DS=720000;
const int DM=12000;
const int DH=1000;
const int MOD=360*12000; int degS=-DS,degM=-DM,degH=-DH; int ADD()
{
degS=(degS+DS)%MOD;
degM=(degM+DM)%MOD;
degH=(degH+DH)%MOD; int dur=abs(degM-degH);
if(dur>MOD/2) dur=MOD-dur; return dur;
} void init()
{
for(int h=0;h<=11;h++)
{
for(int m=0;m<=59;m++)
{
for(int s=0;s<60;s+=10)
{
int t=ADD();
mt.insert(make_pair(t,(Time){h,m,s}));
}
}
}
} int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout); init();
int x;
while(scanf("%d",&x)!=EOF)
{
multimap<int,Time>::iterator it;
it=mt.find(x);
int cnt=mt.count(x);
for(int i=0;i<cnt;i++,it++)
{
Time time = it->second;
printf("%02d:%02d:%02d\n",time.hh,time.mm,time.ss);
}
} return 0;
}
HDOJ 5276 YJC tricks time multimap的更多相关文章
- hdu 5276 YJC tricks time 数学
YJC tricks time Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?p ...
- HDU - 5276 YJC tricks time
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5276 Sample Input 99000 0 Sample Output 00:01:30 ...
- 暴力 BestCoder Round #46 1001 YJC tricks time
题目传送门 /* 暴力:模拟枚举每一个时间的度数 详细解释:http://blog.csdn.net/enjoying_science/article/details/46759085 期末考结束第一 ...
- BestCoder Round #46
1001 YJC tricks time 题目链接:1001 题意:给你时针和分针所成的角度,输出现在的时间,以10秒为单位 思路:每10秒,分针走1度,时针走分针的1/12,我们可以根据时间来分别计 ...
- SPFA+Dinic HDOJ 5294 Tricks Device
题目传送门 /* 题意:一无向图,问至少要割掉几条边破坏最短路,问最多能割掉几条边还能保持最短路 SPFA+Dinic:SPFA求最短路时,用cnt[i]记录到i最少要几条边,第二个答案是m - cn ...
- HDOJ 5294 Tricks Device 最短路(记录路径)+最小割
最短路记录路径,同一时候求出最短的路径上最少要有多少条边, 然后用在最短路上的边又一次构图后求最小割. Tricks Device Time Limit: 2000/1000 MS (Java/Oth ...
- C++ std::multimap
std::multimap template < class Key, // multimap::key_type class T, // multimap::mapped_type class ...
- HDOJ 1009. Fat Mouse' Trade 贪心 结构体排序
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
随机推荐
- 关于storyboard的一点学习记录
1.storyboard中“Main storyboard file base name”这个用来注册启动是所需要的storyboard 文件名称.当我们程序启动的时候,我们的工程就会根据这一项来自动 ...
- 关于WM_ERASEBKGND和WM_PAINT的深刻理解
一直以来,对于WM_PAINT和WM_ERASEBKGND消息不是很清楚,从书上和网上找了很多资料,大体上有以下几点说法:1>WM_PAINT先产生,WM_ERASEBKGND后产生 2.WM_ ...
- 关于Delphi中的字符串的浅析(瓢虫大作,里面有内存错误的举例)
关于Delphi中的字符串的浅析 只是浅浅的解析下,让大家可以快速的理解字符串. 其中的所有代码均在Delphi7下测试通过. Delphi 4,5,6,7中有字符串类型包括了: 短字符串(Short ...
- Java设计模式之适配器模式(Adapter Pattern)
Adapter Pattern的作用是在不改变功能的前提下转换接口.Adapter分为两类,一类是Object Adapter, 还有一类是Class Adapter.因为Class Adapter的 ...
- STL 之 queue、priority_queue 源代码剖析
/* * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute an ...
- Missing artifact net.sf.json-lib:json-lib:jar:2.2.3:compile
json-lib是需要区分jdk版本的,pom.xml中的配置应加上<classifier>标签,如用jdk15: <dependency> <groupId>ne ...
- Java编码浅析(注意区分三个概念)(转)
编码: (1)外部资源的字符集-----没有读入jvm中的数据都是外部资源 (2)jvm中数据的字符集-----都是unicode (1)和(2)之间发生交互时,如果不指定编码,则使用JVM平台默认字 ...
- Swift初窥--使用Swift实现TableView
完毕Swift的语法关之后.来点实际的Task,第一个任务是写一个tableview,使用cocoaTouch里tableview这个经常使用的控件. 创建project.选择Swift语言 首先是用 ...
- [置顶] android开发之来电自动拒接并自动回复短信_上课模式app
上课的时候老师说总是错过电话,对方打来没人接还一遍遍的打,觉得可以有个app在上课期间自动拒接电话,并自动回复短信过去. 当然了,需要权限的. 尝试做了个雏形出来. 界面如下: 主要代码如下: pac ...
- HP MSA2312 ERROR
司在用的hp MAS2312存储其中一台每天都会报一个错误 EVENT:Vdisk verification failed. Command failed. (error code: 1) 2 err ...