YJC tricks time(钟表问题)


Link:http://acm.hdu.edu.cn/showproblem.php?pid=5276


YJC tricks time

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/262144 K (Java/Others)
Total Submission(s): 109    Accepted Submission(s): 45


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
 

Recommend
hujie   |   We have carefully selected several similar problems for you:   5279  5278  5277  5275  5274 
 

AC  code:

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<queue>
#include<map>
using namespace std;

int main()
{
    int i,j,k,d,di,dj,hh,mm,ss,t;
    //freopen("D:\in.txt","r",stdin);
    while(scanf("%d",&d)!=EOF)
    {
        for(i=0;i<=11;i++)
        {
            for(j=0;j<=59;j++)
            {
                for(k=0;k<=50;k+=10)
                {
                    di=(i*3600+j*60+k)*100;
                    dj=(j*60+k)*1200;
                    t=abs(di-dj);
                    if(t>2160000)
                        t=4320000-t;
                    if(t==d)
                    {
                        if(i<10)
                            printf("0%d:",i);
                        else
                            printf("%d:",i);
                        if(j<10)
                            printf("0%d:",j);
                        else
                            printf("%d:",j);
                        if(k<10)
                            printf("0%d\n",k);
                        else
                            printf("%d\n",k);
                    }
                }
            }
        }
    }
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

林下的码路

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值