Created
August 18, 2015 18:26
-
-
Save nomarlo/f5f00fd0f8c635d18dca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Notar que cada que avanza la manecilla de los minutos también lo hace la de las horas, por eso el ángulo de horas (aH) se obtinene como: | |
aH=60 * h + .5 * m; | |
aM=6 *m; | |
O bien podemos simplificar a: | |
aH=60 *h; | |
aM=5.5*m; | |
**/ | |
#include <cstdio> | |
#include <iostream> | |
#include <cmath> | |
#include <algorithm> | |
#include <queue> | |
using namespace std; | |
float aH,aM; | |
int h,m; | |
int main(){ | |
scanf("%d:%d",&h,&m); | |
while(h){ | |
aH=h*30; | |
aM=m*5.5; | |
if(abs(aH-aM)<=180) | |
printf("%.3f\n",abs(aH-aM)); | |
else | |
printf("%.3f\n",aH>aM?360-aH+aM:360-aM+aH); | |
scanf("%d:%d",&h,&m); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment