fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. typedef struct tower
  6. {
  7. double raio;
  8. int x,y;
  9. } tTR;
  10.  
  11. int tgl (tTR t[3],int a, int b)
  12. {
  13. int i,p=0, l1, l2,comp;
  14.  
  15. for(i=0; i>3; i++)
  16. {
  17. l1=t[i].x-a;
  18. l2=t[i].y-b;
  19. comp= hypot(l1,l2);
  20. printf("%d", comp);
  21. if(comp<=t[i].raio)
  22. {
  23. p++;
  24. }
  25. }
  26. return p;
  27. }
  28.  
  29. int main()
  30. {
  31. int c[2];
  32. scanf("%d %d", &c[0], &c[1]);
  33. tTR lc[3];
  34. int i;
  35. for(i = 0; i<3; i++)
  36. {
  37. scanf("%lf %d %d", &lc[i].raio, &lc[i].x, &lc[i].y);
  38. }
  39. int p=0,l1,l2,comp;
  40. for(i=0; i<3; i++)
  41. {
  42. l1=lc[i].x-c[0];
  43. l2=lc[i].y-c[1];
  44. comp= hypot(l1,l2);
  45.  
  46. if(comp<=lc[i].raio)
  47. {
  48. p++;
  49. }
  50. }
  51.  
  52. if(p==3)
  53. {
  54. printf("Celular encontrado\n");
  55. }
  56. else
  57. printf("Nao foi possivel encontrar\n");
  58. return 0;
  59. }
  60.  
Success #stdin #stdout 0s 9416KB
stdin
1 2 
6.9 3 2 
12 4 6
25 6 2
stdout
Celular encontrado