Created
March 10, 2014 17:13
-
-
Save viniciustaveira/9469441 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
#include <stdio.h> | |
#include <math.h> | |
int main(){ | |
int d, vf, vg, safe_waters = 12; | |
float tf, tg, dg; | |
scanf("%i", &d); | |
while(d){ | |
scanf("%i %i", &vf, &vg); | |
//Tempo do Fugitivo até as águas seguras (distância/velocidade) | |
tf = safe_waters / vf; | |
//Distância que a guarda tem que percorrer | |
dg = sqrt( (d * d) + (safe_waters * safe_waters)); | |
//Tempo da Guarda até as águas seguras | |
tg = dg / vg; | |
//Guarda precisa fazer qualquer tempo menor que do Fugitivo | |
if(tg < tf){ | |
printf("S\n"); | |
}else{ | |
printf("N\n"); | |
} | |
d = 0; | |
scanf("%i", &d); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment