UVa 11650 - Mirror Clock

题目:求给定时钟的镜面时间。

分析:简单题。直接用12:00减去当前时间即可,如果小时小于等于0加上12。

说明:没有0:01,只有12:00。

#include <iostream>
#include <cstdlib>
#include <cstdio>

using namespace std;

int main()
{
	int n,h,m,a,b;
	while (~scanf("%d",&n))
	for (int i = 0 ; i < n ; ++ i) {
		scanf("%d:%d",&h,&m);
		a = 12;
		b = 0;
		if (m > 0) {
			b = 60;
			a --;
		}
		b -= m;
		a -= h;
		if (a <= 0) a += 12;
		printf("%02d:%02d\n",a,b);
	}
	return 0;
}
时间: 2024-08-11 21:45:53

UVa 11650 - Mirror Clock的相关文章

UVA 1529 - Clock(数论)

题目链接:1529 - Clock 题意:给定两个时刻,求时针和分针相遇次数. 思路:先把转一圈会相遇的时刻记录下来,这些时刻肯定是固定的,然后由给定的两个时刻a,b,求出12点到a相遇次数c1,12点到b相遇次数c2,ans = c2 - c1 代码: #include <stdio.h> #include <string.h> const double esp = 1e-6; int h1, m1, h2, m2; double t1, t2, s[25]; int main(

uva 1529 - Clock(数论)

题目链接:uva 1529 - Clock 题目大意:给出两个时间,问从第一个时间变成第二个时间分针会和时针重叠几次. 解题思路:两个针重叠的时间是固定的,只要处理出这些重叠的时刻,在判断说给得时间区间包含的个数即可. #include <cstdio> #include <cstring> #include <cmath> const int T = 12 * 60 * 100; const int D = 6545; int sh, sm, eh, em; int

UVa 579 Clock Hands

水题.. 求任意时刻时针和分针的夹角,其结果在0°到180°之间. 这里又一次用到了sscanf()函数,确实很方便. 思路:我们分别求出时针和分针转过的角度,然后大的减小的,如果结果ans大于180,那么ans = 360 - ans.   ClockHands  The medieval interest in mechanical contrivances is well illustrated by the development of the mechanical clock, the

UVa 170 - Clock Patience

题目:Clock Patience游戏,将52张扑克牌,按时钟依次分成13组(中心一组),每组4张全都背面向上, 从中间组最上面一张牌开始,翻过来设为当前值,然后取当前值对应组中最上面的背过去的牌翻过来, 取这个值为新的当前值,直到不能翻拍游戏结束:求结束时,翻过来的拍数以及最后翻过来的牌: 如果没看明白题目具体规则,百度玩一下就明白了. 分析:模拟,数据结构(DS).设计13个栈,模拟即可. 说明:注意题目给的牌的顺序是逆序的,╮(╯▽╰)╭. #include <algorithm> #i

uva 401.Palindromes

题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=342 题目意思:给出一段字符串(大写字母+数字组成).判断是否为回文串 or 镜像串 or 回文镜像串 or 什么都不是.每个字母的镜像表格如下 Character Reverse Character Reverse Character Reverse A A M M Y Y B

uva 753 A Plug for UNIX (最大流)

uva 753 A Plug for UNIX You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of information and ideas on the Internet as cum

用debian 7.5 cd/dvd 搭建局域网mirror镜像源来批量网络无人值守安装debian

1.图形化最小安装debian7.5操作系统 2.更改debian的apt源配置文件/etc/apt/sources.list [email protected]:~# cat /etc/apt/sources.list deb http://ftp.de.debian.org/debian wheezy main contrib non-free deb-src http://ftp.de.debian.org/debian wheezy main contrib non-free 3.更新a

UVa 12325 - Zombie&#39;s Treasure Chest-[分类枚举]

12325 Zombie’s Treasure Chest Some brave warriors come to a lost village. They are very lucky and find a lot of treasures and a big treasure chest, but with angry zombies. The warriors are so brave that they decide to defeat the zombies and then brin

uva 1352 Colored Cubes(枚举)

uva 1352 Colored Cubes There are several colored cubes. All of them are of the same size but they may be colored differently. Each face of these cubes has a single color. Colors of distinct faces of a cube may or may not be the same. Two cubes are sa