首页 技术 正文
技术 2022年11月15日
0 收藏 533 点赞 3,033 浏览 2317 个字

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 DescriptionYJC 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 . InputMultiple 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. OutputFor 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

 SourceBestCoder Round #46 

/* ***********************************************
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: 1000const 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;
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,992
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,506
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,349
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,134
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,767
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,844