Skip to content

Instantly share code, notes, and snippets.

@Tomcat-42
Created September 12, 2019 03:25
Show Gist options
  • Save Tomcat-42/f98022d211a487bbd15c1ebbde16fdb7 to your computer and use it in GitHub Desktop.
Save Tomcat-42/f98022d211a487bbd15c1ebbde16fdb7 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <math.h>
// Retorna a distância entre dois pontos no plano
int dist(int x1,int y1, int x2,int y2);
int main()
{
int l, c, r1, r2;
while(scanf("%d %d %d %d", &l, &c, &r1, &r2) && (l && c && r1 && r2))
{
if((2*r1>l) || (2*r1>c) || (2*r2>l) || (2*r2>c))
printf("N\n");
else if(dist(r1,r1, c-r2, l-r2)>= ((r1+r2) * (r1+r2)))
printf("S\n");
else
printf("N\n");
}
}
int dist(int x1,int y1, int x2,int y2)
{
return(int)pow((x2-x1), 2.0) + pow((y2-y1), 2.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment