UVA10339 Watching Watches

题目大意:有两个表,每天都会慢一点时间,给出每天慢得秒数,问下一次重合的时刻。

解题思路:时刻重合也就是说整整差了一周,一周是12小时,用12小时的秒数除以两个表的相差那就是需要多少天的时间后重合,知道了需要多少天*每一天某个表走的时间(注意要减去少走的时间)即使答案,化成时间的格式即可,注意0时显示成12时。

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int m, c, h, t1, t2;
    double t3;
    long long n;
    while(~scanf("%d%d",&t1,&t2))
    {
        if(t1==t2)
        {
            printf("%d %d 12:00\n",t1,t2);
            continue;
        }
        c=abs(t1-t2);
        t3=12.0*3600.0/c;
        long long n=t3*(24*3600-t1);
        n %=43200;
        m=n/60;
        n%=60;
        if(n>=30) m++;
        h=m/60;
        m%=60;
        if(h==0) h=12;
        printf("%d %d %02d:%02d\n",t1,t2,h,m);
    }
    return 0;
}
时间: 2024-10-12 20:58:49

UVA10339 Watching Watches的相关文章

UVA 10339 Watching Watches

It has been said that a watch that is stopped keeps better time than one that loses 1 second per day. The one that is stopped reads the correct time twice a day while the one that loses 1 second per day is correct only once every 43,200 days. This ma

Watches OpenCart 主题模板 ABC-0088

WATCHES OPENCART 主题模板 ABC-0088 Features : Compatible with the most common browsers: FireFox 1.5-3.5.6+, IE8+, Safari 3.2 +, Opera, Google Chrome. Designed with luxurious colors Suitable for shop selling: Computer, Electronics, Mobile store Supports m

replica watches Another 20

another 20 the line, usually are saying ah! may possibly something to oh, not to Tian Wang Bo aunt possibilities, it put now this watch ago really last directed Lixue Wei gone to the piano battle, Wang Bo failed to i believe direct lady's your dorm!

That Diesel powered running watches north america doesn&#39;t need shift and legal requirements within any specific time

The form belonging to the Diesel's court case is totally distinct in addition to being very unlikely to find that remarkable high-quality because of shots solely. That face belonging to the Diesel powered is without a doubt everything that might be l

zookeeper watches

Watches 所有的读操作(getData(),getChildren(),exists())都可以设置一个watch作为附加的操作 Watch的关键特性有 只触发一次(one-timetrigger) Watch当数据变化时,只会被触发一次,之后就会被移除,当数据再次变化时,不会再触发此watch 发送到客户端(sentto the client) 通知客户端是异步的,客户端只会在它收到watch event时才会知道znode改变.通知客户端的过程可能会发生异常,或者网络延迟,但zooke

PyCharm的Debug工具栏中的Watches

In the Watches pane you can evaluate any number of variables or expressions in the context of the current stack frame. The values are updated with each step through the application, and become visible every time the application is suspended. The Watc

Zookeeper 监视(Watches) 简介(转)

Zookeeper C API 的声明和描述在 include/zookeeper.h 中可以找到,另外大部分的 Zookeeper C API 常量.结构体声明也在 zookeeper.h 中,如果如果你在使用 C API 是遇到不明白的地方,最好看看 zookeeper.h,或者自己使用 doxygen 生成 Zookeeper C API 的帮助文档. Zookeeper 中最有特色且最不容易理解的是监视(Watches).Zookeeper 所有的读操作--getData(), getC

Diesel engine designer watches sale made on-line are distributed day-to-day over the web

The process involving diesel engine functioning can vary via style for you to style. Even now, take note of a number of standard regulations: Aside from, you'll find not simply diesel engine types which often can evaluate your elapsed a few moments,

Diesel Watches are usually supplied with a booklet giving the necessary instructions

Practical patrons or persons are the massive benefit of Diesel watches sale online from the Unique watches, same style at low price. However nonetheless the reputation of originals is there. There are Lot of issues to contemplate about the variations