[hdu5387 Clock]时钟夹角问题
题意:给一个时刻,求时针、分钟、秒针三者之间的夹角
思路:确定参照点,求出三者的绝对夹角,然后用差来得到它们之间的夹角,钝角情况用360。减去就行了。
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm> using namespace std; #define X first
#define Y second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define fillchar(a, x) memset(a, x, sizeof(a))
#define copy(a, b) memcpy(a, b, sizeof(a)) typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned long long ull; //#ifndef ONLINE_JUDGE
void RI(vector<int>&a,int n){a.resize(n);for(int i=;i<n;i++)scanf("%d",&a[i]);}
void RI(){}void RI(int&X){scanf("%d",&X);}template<typename...R>
void RI(int&f,R&...r){RI(f);RI(r...);}void RI(int*p,int*q){int d=p<q?:-;
while(p!=q){scanf("%d",p);p+=d;}}void print(){cout<<endl;}template<typename T>
void print(const T t){cout<<t<<endl;}template<typename F,typename...R>
void print(const F f,const R...r){cout<<f<<", ";print(r...);}template<typename T>
void print(T*p, T*q){int d=p<q?:-;while(p!=q){cout<<*p<<", ";p+=d;}cout<<endl;}
//#endif
template<typename T>bool umax(T&a, const T&b){return b<=a?false:(a=b,true);}
template<typename T>bool umin(T&a, const T&b){return b>=a?false:(a=b,true);}
template<typename T>
void V2A(T a[],const vector<T>&b){for(int i=;i<b.size();i++)a[i]=b[i];}
template<typename T>
void A2V(vector<T>&a,const T b[]){for(int i=;i<a.size();i++)a[i]=b[i];} const double PI = acos(-1.0);
const int INF = 1e9 + ;
const double EPS = 1e-8; /* -------------------------------------------------------------------------------- */ int gcd(int a, int b) {
return b? gcd(b, a % b) : a;
}
void pri(int a, int b) {
int g = gcd(a, b);
a /= g;
b /= g;
printf("%d", a);
if (b > ) printf("/%d", b);
putchar(' ');
}
int main() {
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // ONLINE_JUDGE
int T, cas = ;
cin >> T;
while (T --) {
int h, m, s;
scanf("%d:%d:%d", &h, &m, &s);
h = h % ;
int H = * h + * m + s, M = * m + * s, S = * s;
int tot = * ;
int HM = abs(H - M), HS = abs(H - S), MS = abs(M - S);
umin(HM, tot - HM);
umin(HS, tot - HS);
umin(MS, tot - MS);
pri(HM, );
pri(HS, );
pri(MS, );
puts("");
}
return ;
}
[hdu5387 Clock]时钟夹角问题的更多相关文章
- clock时钟
①时钟的偏移(skew):时钟分支信号在到达寄存器的时钟端口过程中,都存在有线网等延时,由于延时,到达寄存器时钟端口的时钟信号存在有相位差,也就是不能保证每一个沿都对齐,这种差异称为时钟偏移(cloc ...
- hdu5387 Clock
Problem Description Give a time.(hh:mm:ss).you should answer the angle between any two of the minute ...
- jquery版时钟(css3实现)
做时钟的主要原因是因为喜欢,觉得它好看(本人对特效有点爱不释手……).做的时候感觉工程量会有点大,做着做着发现实现起来其实并不难,只要理清思绪,其实还蛮简单的(我制作东西喜欢整体方向制定好,然后边做边 ...
- clock
Prime Time中的clock分析包括: 1)Multiple clocks,clock from port/pin,virtual clock. 2)Clock network delay an ...
- linux 时钟源初步分析linux kernel 时钟框架详细介绍
初步概念: 看datasheet的关于时钟与定时器的部分, FCLK供给cpu, HCLK供给AHB总线设备(存储器控制器,中断控制器.LCD控制器.DMA.USB主机控制器等), PCLK供给APB ...
- PM 时钟机制
PM 时钟机制 10.1 Minix3 PM 时钟机制概述在 MINIX3 中,除了前面所讲到的 CLOCK 时钟,在 pm 中也是维持了一个时钟, 我们暂且不分析为啥要这么做,我就分析是怎么实现这个 ...
- 教你五步制作精美的HTML时钟
学了一段时间的HTML.CSS和JS后,给大家做一款漂亮的不像实力派的HTML时钟,先看图:涉及到的知识点有: CSS3动画.DOM操作.定时器.圆点坐标的计算(好多人是不是已经还给自己的老师了~) ...
- 转 CSS3+js实现多彩炫酷旋转圆环时钟效果
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- CSS3使用Animation steps属性实现指针时钟效果
本篇文章由:http://xinpure.com/css3-animation-steps-properties-for-analogue-effects/ animation 默认以 ease 方式 ...
随机推荐
- python圆周率计算小程序(非常慢)
源码: from math import fabs #导入数学模块 from time import perf_counter #导入时间模块 from numba import jit @jit d ...
- eclipse集成 json editor plugin插件
打开eclipse 找到: help--->install new software ——>add name:jsoneditor location:https://marketplace ...
- [YII2] 增删改查2
一.新增 使用model::save()操作进行新增数据 $user= new User; $user->username =$username; $user->password =$pa ...
- EF-相关查询(逐渐完善)
linq查询方式 多条件查询 内连接 左连接 可以执行sql含事务
- PostMan接口测试(很全面的接口测试教程)
一:理论部分 1. 前言 在前后端分离开发时,后端工作人员完成系统接口开发后,需要与前端人员对接,测试调试接口,验证接口的正确性可用性.而这要求前端开发进度和后端进度保持基本一致,任何一方的进度跟不上 ...
- go获取当前项目下所有依赖包
在设置好GOPATH,GOROOT的环境变量的情况下. 在项目配置好pkg.bin.src等这几个目录的情况,进入src目录. 在终端,输入:go get ./... 即可获得所有依赖包.
- Mac home 目录下创建文件夹
example:sudo vim /etc/auto_master before: # Automounter master map +auto_master # Use directory serv ...
- linux的p0f检测,分析抓包信息
p0f是一个纯粹的被动指纹识别工具,它在不干涉双方通信的情况下,通过嗅探的方式来分析流经某一网卡的流量以达到指纹识别的目的 P0f是继Nmap和Xprobe2之后又一款远程操作系统被动判别工具.它支持 ...
- iscsi的工作原理与优化(2)
2.1 iSCSI协议模型,iscsi[会话层协议,即应用协议] iSCSI使用TCP/IP协议在不稳定网络上进行可靠的数据传输.iSCSI层和标准SCSI集在协议栈中的位置如图1所示.iSCSI层包 ...
- java中的Volatile关键字使用
文章目录 什么时候使用volatile Happens-Before java中的Volatile关键字使用 在本文中,我们会介绍java中的一个关键字volatile. volatile的中文意思是 ...