fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5. int l, c, r1, r2, maior;
  6. char saida;
  7.  
  8. while ( scanf("%i %i %i %i",&l, &c, &r1, &r2) ) {
  9. if(l == 0 && c == 0 && r1 == 0 && r2 == 0) { return 0; }
  10. //o teste poderia ser: l+c+r1+r2 == 0
  11. //como os numeros sao sempre positivos, nao teria problema
  12.  
  13. saida = 'N';
  14. if (r1 > r2) {
  15. maior = r1 * 2;
  16. } else {
  17. maior = r2 * 2;
  18. }
  19.  
  20. if(maior <= l && maior <= c) {
  21. if(sqrt(pow((l - r2 - r1), 2) + pow((c - r2 - r1), 2)) >= r1 + r2) {
  22. saida = 'S';
  23. }
  24. }
  25.  
  26. printf("%c\n",saida);
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0s 10320KB
stdin
11 9 2 3
7 8 3 2
10 15 3 7
8 9 3 2
0 0 0 0
stdout
S
N
N
S