首页 > 学院 > 开发设计 > 正文

HDU 2076 (C语言解析)夹角有多大

2019-11-08 02:43:07
字体:
来源:转载
供稿:网友

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

题目链接:http://acm.split.hdu.edu.cn/showPRoblem.php?pid=2076

题解详见代码, 代码如下:

#include<stdio.h>void f(double m,double n){    double temp=m-n;    if(temp<0)        temp=-temp;//取绝对值     if(temp>180)        temp=360-temp;	//取小于180的角     printf("%d/n",(int)temp);}int main(){    int t;    double a,b,c;    double m,n;    scanf("%d",&t);    while(t--)    {        m=n=0;        scanf("%lf%lf%lf",&a,&b,&c);        if(a>12)	//将24小时制,转换为12小时制             a=a-12.0;        n+=b+c/60.0;        m+=a+n/60.0;                n*=6.0;        m*=30.0;//    printf("***%llf %llf/n",m,n);        f(m,n);    }    return 0;}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表