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. [置顶] PMBOOK第四版-ITO与数据流图总结

    具体文档下载地址: 点击打开文档下载地址 :http://download.csdn.net/detail/lyjluandy/6694205 一.过程组与知识领域表(简图) 二.输入 - 工具 - ...

  2. POJ 1955 Rubik's Cube

    暴力模拟就好了.... vim写代码真费事,手都写酸了... Rubik's Cube Time Limit: 1000MS   Memory Limit: 30000K Total Submissi ...

  3. asp.net 检查文件夹和文件是否存在

    原文  asp.net 检查文件夹和文件是否存在 允许 path 参数指定相对或绝对路径信息. 相对路径信息被解释为相对于当前工作目录. 检查该目录是否存在之前,从 path 参数的末尾移除尾随空格. ...

  4. JVM内存管理 (转)

    一.物理内存与虚拟内存1.物理内存                (1)RAM        所谓物理内存就是我们通常所说的RAM(随机存储器).        (2)寄存器        在计算机中 ...

  5. Spark大型项目实战:电商用户行为分析大数据平台

    本项目主要讲解了一套应用于互联网电商企业中,使用Java.Spark等技术开发的大数据统计分析平台,对电商网站的各种用户行为(访问行为.页面跳转行为.购物行为.广告点击行为等)进行复杂的分析.用统计分 ...

  6. boost function对象

    本文根据boost的教程整理. 主要介绍boost function对象的用法. boost function boost function是什么 boost function是一组类和模板组合,用于 ...

  7. 源代码编译lamp环境

    没有办法用 rpm查询一个源代码包是否安装 因为 并不是用rpm安装的 可以先吧 selinux 给禁用掉  iptables -F 把防火墙规则全部删除 首先确保 gcc  gcc-c++   ma ...

  8. MongoDB学习笔记(三) 在MVC模式下通过Jqgrid表格操作MongoDB数据

    看到下图,是通过Jqgrid实现表格数据的基本增删查改的操作.表格数据增删改是一般企业应用系统开发的常见功能,不过不同的是这个表格数据来源是非关系型的数据库MongoDB.nosql虽然概念新颖,但是 ...

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

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

  10. lua 函数回调技巧

    技巧1: local a = {}; function b() print("Hello World") end a["sell"] = {callFunc = ...