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

Problem Description
YJC received a mysterious present. It's a clock and it looks like this. 








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 .
 
Input
Multiple tests.There will be no more than 1000 cases
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.
 
Output
For each case:



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)
 
Sample Input
99000
0
 
Sample Output
00:01:30
11:58:30
00:00:00
 
Source
 

/* ***********************************************
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的更多相关文章

  1. hdu 5276 YJC tricks time 数学

    YJC tricks time Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?p ...

  2. HDU - 5276 YJC tricks time

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5276   Sample Input 99000 0   Sample Output 00:01:30 ...

  3. 暴力 BestCoder Round #46 1001 YJC tricks time

    题目传送门 /* 暴力:模拟枚举每一个时间的度数 详细解释:http://blog.csdn.net/enjoying_science/article/details/46759085 期末考结束第一 ...

  4. BestCoder Round #46

    1001 YJC tricks time 题目链接:1001 题意:给你时针和分针所成的角度,输出现在的时间,以10秒为单位 思路:每10秒,分针走1度,时针走分针的1/12,我们可以根据时间来分别计 ...

  5. SPFA+Dinic HDOJ 5294 Tricks Device

    题目传送门 /* 题意:一无向图,问至少要割掉几条边破坏最短路,问最多能割掉几条边还能保持最短路 SPFA+Dinic:SPFA求最短路时,用cnt[i]记录到i最少要几条边,第二个答案是m - cn ...

  6. HDOJ 5294 Tricks Device 最短路(记录路径)+最小割

    最短路记录路径,同一时候求出最短的路径上最少要有多少条边, 然后用在最短路上的边又一次构图后求最小割. Tricks Device Time Limit: 2000/1000 MS (Java/Oth ...

  7. C++ std::multimap

    std::multimap template < class Key, // multimap::key_type class T, // multimap::mapped_type class ...

  8. HDOJ 1009. Fat Mouse' Trade 贪心 结构体排序

    FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  9. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

随机推荐

  1. git使用说明

    1,git clone git://github.com/schacon/simplegit.git git工作目录,暂存目录,本地代码仓库都有代码了. 2,git pull git://github ...

  2. jbpm部署流程定义到MySql报乱码解决方案

    问题起因: 我在使用ant将流程定义和流程相关资源部署到JBPM数据库中的时候,报了下面一个错误. 错误提示,大概是: 11:33:40,781 ERROR JDBCExceptionReporter ...

  3. Swift 可展开可收缩的表视图

    主要学习与运行效果 在本节的内容中,我们将通过一个具体实例的实现过程,详细讲解在表视图当中,如何创建一个可展开可收缩的表视图.为了让读者有着更为直观的印象,我们将通过模仿QQ好友列表来实现这个效果. ...

  4. html怎么引用css

    <head> <title>统一站内风格</title> <link rel="stylesheet" type="text/c ...

  5. [Cocos2d-x]Mac下运行HelloCpp For Android

    2013年12月22日 一.简介: Mac下运行Cocos2d-x的samples和新建的HelloCocos2dx项目 二.内容: 环境: OS:mac OS X 10.9.1 IDE:Androi ...

  6. CF 514C(hash)

    传送门:Watto and Mechanism 题意:输入a个字符串和b个待检测字符串.问待检测字符串是否可以由某个已知字符串改变且只改变一个字母得到. 分析:字符串hash,枚举待测字符串每一位进行 ...

  7. dvtm: 平铺式终端管理器 — LinuxTOY

    dvtm: 平铺式终端管理器 — LinuxTOY LinuxTOY 是一个致力于提供 Linux 相关资讯的专题站点.如果您发现了好用好玩的 Linux 东东并愿意发扬自由.分享的精神,可以点击顶部 ...

  8. struts2+jquery +json实现异步加载数据,亲测(原创)

    //初始加载页面时 $(document).ready(function(){ //为获取单个值的按钮注册鼠标单击事件 $("#getMessage").click(functio ...

  9. 20.23. xmlrpclib — XML-RPC client access — Python v2.7.5 documentation

    20.23. xmlrpclib — XML-RPC client access — Python v2.7.5 documentation 20.23. xmlrpclib — XML-RPC cl ...

  10. UVA 620 Cellular Structure (dp)

     Cellular Structure  A chain of connected cells of two types A and B composes a cellular structure o ...