UVA - 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的更多相关文章
- Uva 10339 - Watching Watches【数论,暴力】
题目链接:10339 - Watching Watches 题意:两个时钟,一个每天慢a秒,一个每天慢b秒,问两钟重新相遇的时刻 1圈有12 * 60 * 60秒,然后1圈 / abs(a - b), ...
- UVa - 10339
It has been said that a watch that is stopped keeps better time than one that loses 1 second per day ...
- UVA10339 Watching Watches
题目大意:有两个表,每天都会慢一点时间,给出每天慢得秒数,问下一次重合的时刻. 解题思路:时刻重合也就是说整整差了一周,一周是12小时,用12小时的秒数除以两个表的相差那就是需要多少天的时间后重合,知 ...
- UVa 12715 Watching the Kangaroo(二分)
题意:n条线段(n <= 100000) (L<=R <= 1e9) ,m组询问(m <= 100000) 每次询问一个点的覆盖范围的最大值.一个点x对于一条包括其的线段,覆盖 ...
- 【暑假】[数学]UVa 1262 Password
UVa 1262 Password 题目: Password Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld ...
- UVA - 10057 A mid-summer night's dream.
偶数时,中位数之间的数都是能够的(包含中位数) 奇数时,一定是中位数 推导请找初中老师 #include<iostream> #include<cstdio> #include ...
- UVA 1262 Password 暴力枚举
Password Time Limit: 3000ms Memory Limit: 131072KB This problem will be judged on UVA. Original ID: ...
- uva 1354 Mobile Computing ——yhx
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABGcAAANuCAYAAAC7f2QuAAAgAElEQVR4nOy9XUhjWbo3vu72RRgkF5
- UVA 10564 Paths through the Hourglass[DP 打印]
UVA - 10564 Paths through the Hourglass 题意: 要求从第一层走到最下面一层,只能往左下或右下走 问有多少条路径之和刚好等于S? 如果有的话,输出字典序最小的路径 ...
随机推荐
- mongodb命令行基础语法
首先是安装并配置mongodb,这个请自行百度,安装完成后打开cmd命令输入mongo.我们现在先做一个例子吧,假设有一个班级叫c1,里面有若干个人,里面的人有姓名.年龄.性别和班级,我们分别对他们进 ...
- [数据结构]C语言栈的实现
有始有终,所以我准备把各种数据结构都讲一次,栈也分顺序存储和链式储存,这里我们选择链式存储来讲,顺序存储没有难度(链式其实也是) 作为数据结构中最简单的栈,这里不会说太多,首先考虑一下下面的model ...
- Zip4J最简单用法
package com.chentao.MicroMessage.bussiness; import java.io.File; import java.util.ArrayList; import ...
- ArcGIS 网络分析[2.3] 最近设施点
什么是最近设施点? 仍然举一个生动形象例子说明. 我在大街的某一个点儿上,我急需上厕所,问:我3分钟内能到的最近的厕所在哪? 这就是最近设施点分析(ClosestFacility)--给定搜索半径,基 ...
- canvas学习api
1.canvas.getContext():获取渲染上下文和绘画功能: 一.绘制矩形 2.ctx.fillRect(x,y,width,height):绘制矩形: 3.ctx.strokeRect(x ...
- Java基础之引用(String,char[],Integer)总结
1.String的引用: 下列代码执行后的结果为: public class Test { public static void main(String[] args) { StringBuffer ...
- java构造器执行顺序一个有趣的简单实例
一 Animal为父类,构造器中调用public(default.protected) say方法,Dog继承了Animal,并重载了say方法.新建Dog对象,查看运行结果,若将Animal中say ...
- How It Works: CMemThread and Debugging Them
The wait type of CMemThread shows up in outputs such as sys.dm_exec_requests. This post is intended ...
- 每天学一点Docker(3)(制作你的第一个容器)
今天开始制作第一个容器,其实很简单 首先你要准备这些条件: 1.一个Ubuntu系统 2.这个系统能够联网,最起码ping www.baidu.com是可以的 这些准备条件准备好了,接下来就开始做准备 ...
- 无法向Windows服务器复制粘贴文件
在向服务器拷贝文件的时候卡死,直接任务管理器结束应用程序,但是随之引发一个问题,就是之后不能从本地向服务器拷贝文件了,只能服务器自己复制粘贴. 解决办法重启rdpclip.exe,先在任务管理器中结束 ...