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. 一种根据URL参数条件动态生成URL的方法

    最近做了一个产品列表页类似于搜索列表页, 功能比较简单,比搜索页复杂的逻辑在于,生成各个查询条件的URL.我们的链接如下: http://xxx.xxx.xxx/product/list.html?s ...

  2. mysql 创建函数set global log_bin_trust_function_creators=TRUE;

    <pre name="code" class="html">set global log_bin_trust_function_creators=T ...

  3. ProgressDialog使用汇总

    ProgressDialog使用  ProgressDialog 从继承AlertDialog,AlertDialog继承自Dialog,实现DialogInterface接口. ProgressDi ...

  4. flask开发restful api

    flask开发restful api 如果有几个原因可以让你爱上flask这个极其灵活的库,我想蓝图绝对应该算上一个,部署蓝图以后,你会发现整个程序结构非常清晰,模块之间相互不影响.蓝图对restfu ...

  5. 轻量级工具网站SimpleTools

    [解释]本来这篇文章是在前天发出来的,可是当时是刚申请的域名,现在都要域名实名认证,导致我发的项目网址打不开,惹来了很多博友的吐槽,在此说声抱歉,今天一大早就把实名认证提交了,现在网站已经可以正常访问 ...

  6. php可获取客户端信息

    <?php echo "<br>".$_SERVER['PHP_SELF'];#当前正在执行脚本的文件名,与 document root相关 echo " ...

  7. 14.6.3 Grouping DML Operations with Transactions 组DML操作

    14.6.3 Grouping DML Operations with Transactions 组DML操作 默认情况下,连接到MySQL server 开始是以启动自动提交模式, 会自动提交每条S ...

  8. 文顶顶 iOS开发UI篇—UITabBarController简单介绍 iOS开发UI篇—UITabBarController简单介绍

    一.简单介绍 UITabBarController和UINavigationController类似,UITabBarController也可以轻松地管理多个控制器,轻松完成控制器之间的切换,典型的例 ...

  9. 《大数据互联网大规模数据挖掘与分布式处理》阅读笔记(四)-----WEB广告

    作者: 沈慧 目前,许多WEB应用通过广告而维持生计,从在线广告中获益最多的是搜索应用,“adwords”模型就是一种用于搜索查询和广告匹配的模型.这一章介绍了在线广告的相关问题.在线算法.Adwor ...

  10. QS Network(最小生成树)

    题意:若两个QS之间要想连网,除了它们间网线的费用外,两者都要买适配器, 求使所有的QS都能连网的最小费用. 分析:这个除了边的权值外,顶点也有权值,因此要想求最小价值,必须算边及顶点的权值和. 解决 ...