Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. #include<iostream>
  2. inline int readChar();
  3. template <class T = int> inline T readInt();
  4. template <class T> inline void writeInt( T x, char end = 0 );
  5. inline void writeChar( int x );
  6. inline void writeWord( const char *s );
  7. static const int buf_size = 4096;
  8. inline int getChar() {
  9. static char buf[buf_size];
  10. static int len = 0, pos = 0;
  11. if (pos == len)
  12. pos = 0, len = fread(buf, 1, buf_size, stdin);
  13. if (pos == len)
  14. return -1;
  15. return buf[pos++];
  16. }
  17. inline int readChar() {
  18. int c = getChar();
  19. while (c <= 32)
  20. c = getChar();
  21. return c;
  22. }
  23. template <class T>
  24. inline T readInt() {
  25. int s = 1, c = readChar();
  26. T x = 0;
  27. if (c == '-')
  28. s = -1, c = getChar();
  29. while ('0' <= c && c <= '9')
  30. x = x * 10 + c - '0', c = getChar();
  31. return s == 1 ? x : -x;
  32. }
  33. static int write_pos = 0;
  34. static char write_buf[buf_size];
  35. inline void writeChar( int x ) {
  36. if (write_pos == buf_size)
  37. fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
  38. write_buf[write_pos++] = x;
  39. }
  40.  
  41. template <class T>
  42. inline void writeInt( T x, char end ) {
  43. if (x < 0)
  44. writeChar('-'), x = -x;
  45.  
  46. char s[24];
  47. int n = 0;
  48. while (x || !n)
  49. s[n++] = '0' + x % 10, x /= 10;
  50. while (n--)
  51. writeChar(s[n]);
  52. if (end)
  53. writeChar(end);
  54. }
  55. struct Flusher {
  56. ~Flusher() {
  57. if (write_pos)
  58. fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
  59. }
  60. } flusher;
  61. double d,x[10001],y[10001],r[10001];
  62. uint_fast16_t n,xx,i,j;
  63. int main()
  64. {
  65. n=readInt();
  66. for(i=0; i<n; i++)
  67. {
  68. xx=readInt();
  69. x[i]=xx;
  70. xx=readInt();
  71. y[i]=xx;
  72. xx=readInt();
  73. r[i]=xx;
  74. for(j=0; j<i; j++)
  75. {
  76. d=((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
  77. if((r[i]+r[j])*(r[i]+r[j])>=d && d>=(r[i]-r[j])*(r[i]-r[j]))
  78. {
  79. writeInt(j+1,' ');
  80. writeInt(i+1);
  81. return 0;
  82. }
  83. }
  84.  
  85. }
  86. writeChar('0');
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement