朱色虫居
Pages
Home
Featured Posts
2006/09/21
579-Clock Hands
/*
"Clock Hands"
Level:2.5
Date:2006/9/20
技巧:一小時時針走30度,一分鐘時針走0.5度.
一分鐘,分針走6度 .
*/
#include
main(){
int h=0, m=0;
float degree=0.0f;
do{
scanf("%d:%d",&h,&m);
if(h==0 && m==0)
break;
degree = h*30+m*0.5- m*6;
if(degree < 0) //先取角度的絕對值. degree = -degree; if(degree > 180) //大於180度時,要取補角.
degree = 360 - degree;
printf("%.3f\n",degree);
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment