10339 - Watching Watches

Time limit: 3.000 seconds

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 maxim applies to old fashioned 12-hour analog watches, whose hands move continuously (most digital watches would display nothing at all if stopped). Given two such analog watches, both synchronized to midnight, that keep time at a constant rate but run slow by k and m seconds per day respectively, what time will the watches show when next they have exactly the same time?
Input
Input consists of a number of lines, each with two distinct non-negative integers k and m between 0 and 256, indicating the number of seconds per day that each watch loses.
Output
For each line of input, print k, m, and the time displayed on each watch, rounded to the nearest minute. Valid times range from 01:00 to 12:59.
Sample Input
1 2

0 7
Sample Output
1 2 12:00

0 7 10:17

题意就是两个钟,都慢,慢的多少不同,问多久可以使得指针指的一样(时针和分针,秒针忽略)

就是转12个小时(一圈就可以呗),再加上现在的时间就可以。

无奈,小白菜,自己写的wa了,大佬给讲了也没明白式子什么意思。。。

代码:

#include<bits/stdc++.h>
using namespace std;
int main(){
int k,m;
while(~scanf("%d%d",&k,&m)){
int n=abs(k-m);
double days=*1.0/n;
int sum=(int)(days*(-k)/60.0+0.5)%;
int hour=sum/;
hour%=;
if(hour==) hour=;
int minute=sum%;
printf("%d %d %02d:%02d\n",k,m,hour,minute);
}
return ;
}

UVA - 10339-Watching Watches的更多相关文章

  1. Uva 10339 - Watching Watches【数论,暴力】

    题目链接:10339 - Watching Watches 题意:两个时钟,一个每天慢a秒,一个每天慢b秒,问两钟重新相遇的时刻 1圈有12 * 60 * 60秒,然后1圈 / abs(a - b), ...

  2. UVa - 10339

    It has been said that a watch that is stopped keeps better time than one that loses 1 second per day ...

  3. UVA10339 Watching Watches

    题目大意:有两个表,每天都会慢一点时间,给出每天慢得秒数,问下一次重合的时刻. 解题思路:时刻重合也就是说整整差了一周,一周是12小时,用12小时的秒数除以两个表的相差那就是需要多少天的时间后重合,知 ...

  4. UVa 12715 Watching the Kangaroo(二分)

    题意:n条线段(n <= 100000) (L<=R <= 1e9) ,m组询问(m <= 100000) 每次询问一个点的覆盖范围的最大值.一个点x对于一条包括其的线段,覆盖 ...

  5. 【暑假】[数学]UVa 1262 Password

    UVa 1262  Password 题目: Password   Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld ...

  6. UVA - 10057 A mid-summer night&#39;s dream.

    偶数时,中位数之间的数都是能够的(包含中位数) 奇数时,一定是中位数 推导请找初中老师 #include<iostream> #include<cstdio> #include ...

  7. UVA 1262 Password 暴力枚举

    Password Time Limit: 3000ms Memory Limit: 131072KB This problem will be judged on UVA. Original ID:  ...

  8. uva 1354 Mobile Computing ——yhx

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABGcAAANuCAYAAAC7f2QuAAAgAElEQVR4nOy9XUhjWbo3vu72RRgkF5

  9. UVA 10564 Paths through the Hourglass[DP 打印]

    UVA - 10564 Paths through the Hourglass 题意: 要求从第一层走到最下面一层,只能往左下或右下走 问有多少条路径之和刚好等于S? 如果有的话,输出字典序最小的路径 ...

随机推荐

  1. 点击button1弹出form2,并在form2中点击button2来调用form1的方法

    链接地址:http://www.sufeinet.com/thread-1273-1-1.html   1.     private void button1_Click(object sender, ...

  2. python 将文件夹内的图片转换成PDF

    import os import stringfrom PIL import Imagefrom reportlab.lib.pagesizes import A4, landscapefrom re ...

  3. bzoj 2959: 长跑

    Description 某校开展了同学们喜闻乐见的阳光长跑活动.为了能"为祖国健康工作五十年",同学们纷纷离开寝室,离开教室,离开实验室,到操场参加3000米长跑运动.一时间操场上 ...

  4. 30分钟入门Java

    技术只是工具,文档只是说明书,仅此而已. 写在前面 工作4年有余,盲人摸象般的走过弯路,也投机取巧的领悟到过一些类似"编程本质"的东西.现在开始我计划回顾下我的编程生涯.在这里分享 ...

  5. Django ORM详解

    ORM:(在django中,根据代码中的类自动生成数据库的表也叫--code first) ORM:Object Relational Mapping(关系对象映射) 我们写的类表示数据库中的表 我们 ...

  6. JS通过decodeURIComponent函数解码

    在我们调用后台接口的时候,如果后端传过来的字段是编码过的,那需要使用decodeURIComponent函数进行解码显示 var test1="http://www.jianshu.com/ ...

  7. Box布局

    import sys from PyQt4 import QtCore, QtGui class MainWindow(QtGui.QWidget): def __init__(self, paren ...

  8. ES6小点心之通用弹窗

    小点心,顾名思义,开箱即食,拿来即用. 前端业务逻辑主要分为[交互效果]和[数据展示]两方面.数据展示可使用 MVVM 框架来实现.前端的交互效果常用的也就那么几种,比如弹窗,楼层定位,倒计时,下拉刷 ...

  9. python3之socket&socketserver网络编程

    1.套接字与套接模块 套接字是为特定网络协议(例如TCP/IP,ICMP/IP,UDP/IP等)套件对上的网络应用程序提供者提供当前可移植标准的对象.它们允许程序接受并进行连接,如发送和接受数据.为了 ...

  10. Oracle之 11gR2 RAC 修改监听器端口号的步骤

    Oracle 11gR2 RAC 修改监听器端口号的步骤 说明:192.168.188.181 为public ip1192.168.188.182 为public ip2192.168.188.18 ...