zoukankan      html  css  js  c++  java
  • HDU2076 夹角有多大

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

    Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 25012    Accepted Submission(s): 9761

    Problem Description

    时间过的好快,一个学期就这么的过去了,xhd在傻傻的看着表,出于对数据的渴望,突然他想知道这个表的时针和分针的夹角是多少。现在xhd知道的只有时间,请你帮他算出这个夹角。
    注:夹角的范围[0,180],时针和分针的转动是连续而不是离散的。

    Input

    输入数据的第一行是一个数据T,表示有T组数据。
    每组数据有三个整数h(0 <= h < 24),m(0 <= m < 60),s(0 <= s < 60)分别表示时、分、秒。

    Output

    对于每组输入数据,输出夹角的大小的整数部分。

    Sample Input

    2 8 3 17 5 13 30

    Sample Output

    138 75

    代码如下:

    #include <iostream>
    #include <cstdio>
    #include <algorithm>
    #include <cmath>
    #include <cstring>
    using namespace std;
    int main(){
        int t;
        double h,m,s;
        double dushu;
        cin>>t;
        while(t--){
           cin>>h>>m>>s;
           if(h>=12) h=h-12;
           m=6*m+s/10;
           h=30*h+m/12-m;
           if(h<0) h=-h;
           if(h>180) h=360-h; 
           cout<<(int)h<<endl;
        }
        return 0;
    }
    天晴了,起飞吧
  • 相关阅读:
    假设的立场
    Win32资源的使用
    printf()可变域宽输出
    C语言qsort()函数
    OSG-VS2013-X64编译
    Windows下64位SQLite3.10动态库编译
    linux常用命令-个人收藏
    MongoDB3.0安装
    nginx+fastcgi+spawn-fcgi
    linux中codeblocks程序编译运行后不出现控制台窗口
  • 原文地址:https://www.cnblogs.com/jianqiao123/p/11306584.html
Copyright © 2011-2022 走看看