| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1003 人关注过本帖
标题:HIT ACM 1002 The Angle 为啥WA啊?? 高手帮忙啊~~
只看楼主 加入收藏
glovenone
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-11-3
收藏
 问题点数:0 回复次数:1 
HIT ACM 1002 The Angle 为啥WA啊?? 高手帮忙啊~~
The interval angle between the hour hand and the minute hand is always among 0 degree and 180 degree(including 0 and 180 degree). For example, when it's 12 o'clock, the angle of the two hands is 0 while 6:00 is 180 degree. Try to calculate any degree when it's between 12:00 to 11:59.

Input
The input data are of various situations. Every team consists of two numbers : the first number stands for the hour(great than 0 and less than or equal to 12) and second represents the minute( among [0, 59]). The input ends when the two numbers are both zeros.
Output
Print out the minimum angle between the two hands with the normal time form outputed.
Input Sample

12 0
12 30
6 0
3 0
0 0

Output Sample

At 12:00 the angle is 0.0 degrees.
At 12:30 the angle is 165.0 degrees.
At 6:00 the angle is 180.0 degrees.
At 3:00 the angle is 90.0 degrees.





#include <stdio.h>
#include <math.h>
int main()
{
    int h, m;
    float angle;
    while (scanf("%d %d", &h, &m) == 2)
    {
        if(h == 0 && m == 0)
        break;
        if (h == 12)
            h = 0;
        angle = fabs(m * 6 - h * 30 - m / 2);
        if (h == 0)
        h = 12;
        printf("At %d:%.2d the angle is %.1f degrees.\n", h, m, angle);
    }
    return 0;
}


输出都是对的,交上去就WA~~   无语啊~~
搜索更多相关主题的帖子: The angle 
2008-11-08 02:33
永夜的极光
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2721
专家分:1
注 册:2007-10-9
收藏
得分:0 
%.2d ==> %02d

从BFS(Breadth First Study)到DFS(Depth First Study)
2008-11-08 08:30
快速回复:HIT ACM 1002 The Angle 为啥WA啊?? 高手帮忙啊~~
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013733 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved