Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@viniciustaveira
Created March 10, 2014 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viniciustaveira/9469441 to your computer and use it in GitHub Desktop.
Save viniciustaveira/9469441 to your computer and use it in GitHub Desktop.
#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