• Source
    1. #include<stdio.h>
    2. int main()
    3. {
    4. int H,M;
    5. char ch;
    6. float a,b,c,d,e,f;
    7. while(scanf("%d%c%d",&H,&ch,&M)!=EOF)
    8. {
    9. if(H==0 && M==0)
    10. break;
    11. a=H*60;
    12. b=a+M;
    13. c=b*.5;
    14. d=M*6;
    15. if(c>d)
    16. {
    17. e=c-d;
    18. }
    19. else
    20. {
    21. e=d-c;
    22. }
    23. if(e>180)
    24. {
    25. f=360-e;
    26. printf("%.3f\n",f);
    27. }
    28. else if(e<=180)
    29. {
    30. printf("%.3f\n",e);
    31. }
    32. }
    33. return 0;
    34. }