题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5387

比较水的一道题目,也是自己单翘的第一道题目吧,题意就是找到给定时间时钟三个指针之间的夹角,

需要注意的问题分数的表示方法,辗转相除求最大公因子,同时除去,

此外还应注意夹角为锐角。

 #include<stdio.h>
 #include<cmath>
 #include<algorithm>
 using namespace std;
 int gcd(int a,int b)
 {
     int r;
     if(a<b) {r=a;a=b;b=r;}
     while(b)
     {
         r=a%b;
         a=b;
         b=r;
     }
     return a;
 }
 void per( int &a, int &b){
     int tmp = gcd(a,b);
     a = a / tmp;
     b = b / tmp;
 }
 void show( int a, int b, int c, int d){
      )
         a = a % (  * b);
      )
         c = c % (  * d);
     *abs(a*d-b*c);
     int mot = b*d;
     son = son %( b*d*);
      )
         son = b*d* - son;
     per(son,mot);
      )
         printf("%d/%d ",son,mot);
     else
         printf("%d ",son);
 }
 int main(){
 //    freopen("test.out","r",stdin);
     int T;
     ];
     int hh, mm, ss;
     int total;
     int total2;
     int total3;
     int hour ;
     int minu ;
     int sec ;
     scanf("%d",&T);
     while(T--){
         hour = ;
         minu = ;
         sec = ;
         scanf("%s", in);
         hh = (]-+(]-');
         mm = (]-+(]-');
         ss = (]-+(]-');
         total = ( ss + mm *  + hh *  ) % (  *  );
         total2 = total;
         total3 = total;
         per(total,hour);
         per(total2,minu);
         per(total3,sec);
         show(total,hour,total2,minu);
         show(total,hour,total3,sec);
         show(total3,sec,total2,minu);
         printf("\n");
     }
 }

hdoj 5387(Clock)的更多相关文章

  1. hdu1209(Clock)

    pid=1209">点击打开hdu1209 Problem Description There is an analog clock with two hands: an hour h ...

  2. hdoj 2602(背包)

    Problem D Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Sub ...

  3. hdoj 1087 (DP)

    代码: #include<iostream>   #include<cmath>   using namespace std;  int a[1005], dp[1005];  ...

  4. linux入门基础_centos(一)--基础命令和概念

    闲来无事干,看看2014自己整理的一些学习笔记.独乐了不如众乐乐吗! 贴出来和大家分享一下,由于篇幅比较长,分成几篇发布吧,由于是学习笔记,可能有些地方写的不是很正确或者说不详细,或者你会看到上面的课 ...

  5. Java8新特性(转载)

    1.Lambda表达式 Lambda表达式(也称为闭包)是整个Java 8发行版中最受期待的在Java语言层面上的改变.使用 Lambda 表达式可以使代码变的更加简洁紧凑. Lambda允许把函数作 ...

  6. java1.8新特性整理(全)

    版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/yitian_66/article/deta ...

  7. Ceisum官方教程2 -- 项目实例(workshop)

    原文地址:https://cesiumjs.org/tutorials/Cesium-Workshop/ 概述 我们很高兴欢迎你加入Cesium社区!为了让你能基于Cesium开发自己的3d 地图项目 ...

  8. Flink架构(三)- 事件-时间(Event-Time)处理

    3. 事件-时间(Event-Time)处理 在“时间语义”中,我们强调了在流处理应用中时间语义的重要性,并解释了处理时间与事件时间的不同点.处理时间较好理解,因为它基于本地机器的时间,它产生的是有点 ...

  9. Cesium应用篇:3控件(1)Clock

    创建 跟Clock相关的主要有Animation控件和Timeline控件,通常两者会放在一起使用. 在Cesium中,Viewer默认开启这两个控件,如果你想要不显示控件,可以在Viewer初始化中 ...

随机推荐

  1. 封装sharedPreferences SettingsSPData

    /*************************************************************************** * 封装sharedPreferences S ...

  2. Windows Store APP- C# to get IP Address

    using Windows.Networking.Connectivity; public String GetIPString() { String ipString = String.Empty; ...

  3. Scala List

    1 介绍 Scala中列表List类似于数组,List所有元素都具有相同的类型,但有两个重要的区别. 首先,列表是不可变的,这意味着一个列表的元素可以不被分配来改变. 第二,列表表示一个链表,而数组平 ...

  4. HDU 5003 Osu!

    解题思路:水题,不多说. #include<cstdio> #include<cstring> #include<algorithm> #include<cm ...

  5. EIG集团简单介绍

    有朋友会问为什么要介绍EIG集团,他们是干什么的?与域名.主机.IDC行业资讯等有啥关系?EIG集团很牛逼么?带着这些疑问,简单的给大家做个介绍,希望能帮助大家了解这个IDC行业里面的“魔鬼”! EI ...

  6. C++宏定义详解

    一.#define的基本用法     #define是C语言中提供的宏定义命令,其主要目的是为程序员在编程时提供一定的方便,并能在一定程度上提高程序的运行效率,但学生在学习时往往不能 理解该命令的本质 ...

  7. Java正确转换html编码

    Java 中能將 html 編碼正確轉換的套件: org.apache.commons.lang.StringEscapeUtils. String source = "The less t ...

  8. 嵌入式 hi3518平台获取网关

    </pre><pre code_snippet_id="495447" snippet_file_name="blog_20141024_1_70650 ...

  9. Android Service 服务

    一. Service简介 Service是android 系统中的四大组件之一(Activity.Service.BroadcastReceiver.ContentProvider),它跟Activi ...

  10. AE+C# 向axPageLayoutControl1添加图例

    原文 AE+C# 向axPageLayoutControl1添加图例 //Get the GraphicsContainer IGraphicsContainer graphicsContainer ...