when i solve problems,i always got TL.My code is below:
[cpp]
#include<stdio.h>
void main()
{
float clock,minute;
float degree;
while(scanf("%f:%f",&clock,&minute)==2)
{
if(!clock&&!minute) break;
degree=(clock*30+minute/2)-minute*6;
while(degree<0)
{
degree+=180;
}
while(degree>=180)
{
degree=360-degree;
}
printf("%.3f\n",degree);
}
}
[/cpp]
and there's someone who can get AC
[cpp]
#include<stdio.h>
main()
{
int h,m,hn,mn;
float ans;
while(scanf(" %d:%d",&h,&m)==2)
{
if(!h&&!m)break;
ans=((h*60)*0.5)+(m*0.5)-(m*6);
if(ans>180)ans=360.000-ans;
else if(ans<0)ans*=-1;
printf("%.3f\n",ans);
}
}
[/cpp]
p.s :the problem is No.579
who can tell me why?
Why TL?
Moderator: Board moderators
-
- New poster
- Posts: 22
- Joined: Sun Oct 20, 2002 6:41 pm
- Location: Lithuania
- Contact: