HDOJ 5276 YJC tricks time multimap

2023-10-13 11:10
文章标签 multimap time tricks hdoj yjc 5276

本文主要是介绍HDOJ 5276 YJC tricks time multimap,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!


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  12000180=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
BestCoder 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;
}



转载于:https://www.cnblogs.com/mengfanrong/p/5154134.html

这篇关于HDOJ 5276 YJC tricks time multimap的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/202771

相关文章

python中time模块的常用方法及应用详解

《python中time模块的常用方法及应用详解》在Python开发中,时间处理是绕不开的刚需场景,从性能计时到定时任务,从日志记录到数据同步,时间模块始终是开发者最得力的工具之一,本文将通过真实案例... 目录一、时间基石:time.time()典型场景:程序性能分析进阶技巧:结合上下文管理器实现自动计时

MySQL中时区参数time_zone解读

《MySQL中时区参数time_zone解读》MySQL时区参数time_zone用于控制系统函数和字段的DEFAULTCURRENT_TIMESTAMP属性,修改时区可能会影响timestamp类型... 目录前言1.时区参数影响2.如何设置3.字段类型选择总结前言mysql 时区参数 time_zon

Python 标准库time时间的访问和转换问题小结

《Python标准库time时间的访问和转换问题小结》time模块为Python提供了处理时间和日期的多种功能,适用于多种与时间相关的场景,包括获取当前时间、格式化时间、暂停程序执行、计算程序运行时... 目录模块介绍使用场景主要类主要函数 - time()- sleep()- localtime()- g

如何使用 Bash 脚本中的time命令来统计命令执行时间(中英双语)

《如何使用Bash脚本中的time命令来统计命令执行时间(中英双语)》本文介绍了如何在Bash脚本中使用`time`命令来测量命令执行时间,包括`real`、`user`和`sys`三个时间指标,... 使用 Bash 脚本中的 time 命令来统计命令执行时间在日常的开发和运维过程中,性能监控和优化是不

linux 下Time_wait过多问题解决

转自:http://blog.csdn.net/jaylong35/article/details/6605077 问题起因: 自己开发了一个服务器和客户端,通过短连接的方式来进行通讯,由于过于频繁的创建连接,导致系统连接数量被占用,不能及时释放。看了一下18888,当时吓到了。 现象: 1、外部机器不能正常连接SSH 2、内向外不能够正常的ping通过,域名也不能正常解析。

python内置模块datetime.time类详细介绍

​​​​​​​Python的datetime模块是一个强大的日期和时间处理库,它提供了多个类来处理日期和时间。主要包括几个功能类datetime.date、datetime.time、datetime.datetime、datetime.timedelta,datetime.timezone等。 ----------动动小手,非常感谢各位的点赞收藏和关注。----------- 使用datet

2015多校联合训练第一场Tricks Device(hdu5294)

题意:给一个无向图,给起点s,终点t,求最少拆掉几条边使得s到不了t,最多拆几条边使得s能到t 思路: 先跑一边最短路,记录最短路中最短的边数,总边数-最短边数就是第二个答案 第一个答案就是在最短路里面求最小割,也就是求最大流,然后根据最短路在建个新图,权为1,跑一边网络流 模板题,以后就用这套模板了 #include <iostream>#include <cstdio>#incl

lua data time

local getTime = os.date(“%c”); 其中的%c可以是以下的一种:(注意大小写) %a abbreviated weekday name (e.g., Wed) %A full weekday name (e.g., Wednesday) %b abbreviated month name (e.g., Sep) %B full month name (e.g., Sep

Event Time源码分析

《2021年最新版大数据面试题全面开启更新》 flink 中Processing Time也就是处理时间在watermark定时生成、ProcessFunction中定时器与时间类型的窗口中都有使用,但是其内部是如何实现注册定时器、如何调用、如何容错保证在任务挂掉在下次重启仍然能够触发任务执行,都是我们今天的主题。首先需要了解一下在flink内部时间系统是由哪些类来共同完成这件事,下面画

大数据-121 - Flink Time Watermark 详解 附带示例详解

点一下关注吧!!!非常感谢!!持续更新!!! 目前已经更新到了: Hadoop(已更完)HDFS(已更完)MapReduce(已更完)Hive(已更完)Flume(已更完)Sqoop(已更完)Zookeeper(已更完)HBase(已更完)Redis (已更完)Kafka(已更完)Spark(已更完)Flink(正在更新!) 章节内容 上节我们完成了如下的内容: 滑动窗口:时间驱动、事件