杭电ACM2076--夹角有多大(题目已修改,注意读题)

http://acm.hdu.edu.cn/showproblem.php?pid=2076

思路很简单。直接贴代码。过程分析有点耗时间。

  1. // #include <stdio.h>
  2. // #include <math.h>
  3. // int main()
  4. // {
  5. // int t;
  6. // double h,m,s;
  7. // //int h,m,s;
  8. // int z;
  9. // scanf("%d",&t);
  10. // while (t--)
  11. // {
  12. // z = 0;
  13. // scanf("%lf%lf%lf",&h,&m,&s);
  14. // //scanf("%d%d%d",&h,&m,&s);
  15. // //printf("asdf");
  16. //
  17. // z = (int)((h+(m+s/60)/60)*360/12-((m+s/60)*360/60)-0.5);
  18. // if (z<0)
  19. // {
  20. // z = -z;
  21. // }
  22. // else if (z>180)
  23. // {
  24. // z = 360-z;
  25. // }
  26. // printf("%d\n",z);
  27. // }
  28. // return 0;
  29. // }
  30.  
  31. /*
  32. #include<stdio.h>
  33. //#include<bits/stdc++.h>
  34. #include<string.h>
  35. #include<iostream>
  36. #include<math.h>
  37. //#include<map>
  38. #include<sstream>
  39. #include<set>
  40. #include<queue>
  41. #include<vector>
  42. #include<algorithm>
  43. #include<limits.h>
  44. #define inf 0x3fffffff
  45. using namespace std;
  46. const double pi = acos(-1.);
  47. int a[100010];
  48. int main()
  49. {
  50. int t;
  51. while(~scanf("%d",&t))
  52. {
  53. while(t--)
  54. {
  55. int h,s,m;
  56. double ans1,ans2;
  57. scanf("%d%d%d",&h,&m,&s);
  58. if(h>=12) h-=12;
  59. ans1=(h+(m*1.0/60)+(s*1.0/3600))*30;//先算时针夹角
  60. ans2=(m+(s*1.0/60))*6;//再算分针
  61. if(fabs(ans1-ans2)>180)
  62. {
  63. printf("%d\n",int(360-(fabs(ans1-ans2))));
  64. }
  65. else
  66. {
  67. printf("%d\n",int(fabs(ans1-ans2)));
  68. }
  69. }
  70. }
  71. return 0;
  72. }
  73. */
  74.  
  75. #include <stdio.h>
  76. #include <math.h>
  77. int main()
  78. {
  79. int t;
  80. int h,s,m;
  81. double ans1,ans2;
  82. scanf("%d",&t);
  83. while (t--)
  84. {
  85. scanf("%d%d%d",&h,&m,&s);
  86. if (h>=) h = h-;
  87. ans1 = (h+(m*1.0/)+(s*1.0/))*;
  88. ans2 = (m+(s*1.0/))*;
  89. if(fabs(ans1-ans2)>)
  90. {
  91. printf("%d\n",int(-(fabs(ans1-ans2))));
  92. }
  93. else
  94. {
  95. printf("%d\n",int(fabs(ans1-ans2)));
  96. }
  97. }
  98. }

杭电ACM2076--夹角有多大(题目已修改,注意读题)的更多相关文章

  1. HDOJ 2076 夹角有多大(题目已修改,注意读题)

    Problem Description 时间过的好快,一个学期就这么的过去了,xhd在傻傻的看着表,出于对数据的渴望,突然他想知道这个表的时针和分针的夹角是多少.现在xhd知道的只有时间,请你帮他算出 ...

  2. HDU 2076 夹角有多大(题目已修改,注意读题)

    Problem Description 时间过的好快,一个学期就这么的过去了,xhd在傻傻的看着表,出于对数据的渴望,突然他想知道这个表的时针和分针的夹角是多少.现在xhd知道的只有时间,请你帮他算出 ...

  3. HDUOJ--2079选课时间(题目已修改,注意读题)

    选课时间(题目已修改,注意读题) Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  4. hdu 2079 选课时间(题目已修改,注意读题)

    http://acm.hdu.edu.cn/showproblem.php?pid=2079 背包 #include <cstdio> #include <cstring> # ...

  5. hdu2079 选课时间(题目已修改,注意读题) 母函数

    计算数的和的种类,母函数裸题 #include<stdio.h> #include<string.h> ],c2[],a,b; int main(){ int T; while ...

  6. hdu 2079 选课时间(题目已改动,注意读题) (母函数)

    代码: #include<cstdio> #include<cstring> using namespace std; int main() { int t; scanf(&q ...

  7. 杭电ACM2080--夹角有多大II

    http://acm.hdu.edu.cn/showproblem.php?pid=2080 /* //Author:nunu // #include <stdio.h> #include ...

  8. HDU 2076 夹角有多大

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2076 夹角有多大(题目已修改,注意读题) Time Limit: 1000/1000 MS (Java ...

  9. 杭电oj2064、2067、2068、2073、2076-2078、2080、2083-2085

    2064  汉诺塔III #include<stdio.h> int main(){ int n,i; _int64 s[]; while(~scanf("%d",&a ...

随机推荐

  1. Understanding page frames and pages

    Memory in Linux is organized in the form of pages (typically 4 KB in size). Contiguous linear addres ...

  2. NSNotificationCenter通知中心

    概述 NSNotificationCenter通知中心,通常用于一对一或者一对多的消息传递,即当一个地方改变时,要求改变其他的一些地方,例如当网络请求回来了新的数据,需要刷新本地信息和本地内存里面的界 ...

  3. 约瑟夫环问题及python与c++实现效率对比

    约瑟夫环是一个数学的应用问题:已知n个人(以编号1,2,3...n分别表示)围坐在一张圆桌周围.从编号为k的人开始报数,数到m的那个人出列;他的下一个人又从1开始报数,数到m的那个人又出列;依此规律重 ...

  4. 【PHP代码审计】 那些年我们一起挖掘SQL注入 - 3.全局防护Bypass之Base64Decode

    0x01 背景 现在的WEB程序基本都有对SQL注入的全局过滤,像PHP开启了GPC或者在全局文件common.php上使用addslashes()函数对接收的参数进行过滤,尤其是单引号.同上一篇,我 ...

  5. c++ 设计模式9 (Abstract Factory 抽象工厂模式)

    5.2 抽象工厂模式 动机:在软件系统中,经常面临着“一系列相互依赖的对象”的创建工作:同时,由于需求的变化,往往存在更多系列对象的创建工作. 代码示例: 实现利用数据库的业务逻辑,支持多数据库(Sq ...

  6. sql server 中将由逗号“,”分割的一个字符串,转换为一个表,并应用与 in 条件

    ,,) 这样的语句和常用,但是如果in 后面的 1,2,3是变量怎么办呢,一般会用字符串连接的方式构造sql语句 string aa="1,2,3"; string sqltxt= ...

  7. 1.5 理解Analyzers,Tokenizers,Filters--目录

    这部分介绍了solr如何分解和处理文本数据的,它包含一下主题: 1.5.1 Analyzers,Tokenizers,Filters概述:主要介绍Analyzers,Tokenizers,Filter ...

  8. 开启AsyncTask从网络加载图片

    /*AsyncTask 异步任务即做一些简单的异步处理 :是handle与线程池的封装 * 第一个泛型:参数类型泛型 * 第二个泛型:更新进度泛型 * 第三个泛型:onProgressUpdate的返 ...

  9. iOS 自定义 shareSDK 容器

    - (void)initializePlat { //添加新浪微博应用 [ShareSDK connectSinaWeiboWithAppKey:@"3201194191" app ...

  10. [Java] JAVA程序员您需要学习的25个标准

    (1) 你需要精通面向对象分析与设计(OOA/OOD).涉及模式(GOF,J2EEDP)以及综合模式.你应该了解UML,尤其是class,object,interaction以 及statediagr ...