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. Boost::Asio::Error的用法浅析

    一般而言我们创建用于接收error的类型大多声明如下: boost::system::error_code error 我们用这个类型去接受在函数中产生的错误 如 socket.connect( en ...

  2. 关于yaf的控制器命名,一个纠结的问题(续)

    以下方案缺少loader相关的步骤,明天补上!!! 前面写过一篇<关于yaf的控制器命名,一个纠结的问题>.没想到yaf群里面也有跟我遇到一样问题的人,分享下解决办法. 写完那篇博文后,我 ...

  3. 转载【浅谈ThreadPool 线程池】

    浅谈ThreadPool 线程池 http://www.cnblogs.com/xugang/archive/2010/04/20/1716042.html

  4. C 文件直接包含

    C 文件直接包含 有一部分代码很大,在很多函数中重复,可以直接写在另外的一个文件中,引用时直接包含.co.cpp两个函数都 包含c1.cxx. 点击(此处)折叠或打开 ////// co.cpp #i ...

  5. linux下远程管理利器-tmux

    linux下远程管理利器-tmux 1.控制键       控制键就是tmux的主键.当你在tmux环境下按下这个键的时候,tmux就会把你后面输入的指令,解析成它内置的功能.tmux默认的控制键是 ...

  6. [to do list][PCB][questions]and[plan]

    Questions 2014/5/29 1.最后检查布板,除了用netlist查,还有没有更快的方法? 2014/6/8 1.      R的location中心究竟是哪个? watermark/2/ ...

  7. [Java学习笔记]Java Tips

    1.Java没有sizeof关键字 , volatile是java关键字.详情见:http://www.cnblogs.com/aigongsi/archive/2012/04/01/2429166. ...

  8. jQuery EasyUI API 中文文档 - 链接按钮(linkbutton)

    <html> <head> <script src="jquery-easyui/jquery.min.js"></script> ...

  9. http staus汇总

    参考http://www.cnblogs.com/cxd4321/archive/2008/11/20/1337776.html 常见HTTP状态码 200 OK 301 Moved Permanen ...

  10. CountDownLatch和CyclicBarrier的区别(转)

    在网上看到很多人对于CountDownLatch和CyclicBarrier的区别简单理解为CountDownLatch是一次性的,而CyclicBarrier在调用reset之后还可以继续使用.那如 ...