fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. ios_base::sync_with_stdio(0);
  6. cin.tie(0);
  7. int x,y,n,x1,y1,r1,x2,y2,r2,c;
  8. cin >> n;
  9. for(int i = 0;i < n;++i){
  10. cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
  11.  
  12.  
  13. if(x1 >= x2){
  14. x = x1-x2;
  15. }
  16. else if(x2 > x1){
  17. x = x2-x1;
  18. }
  19. if(y1 >= y2){
  20. y = y1-y2;
  21. }
  22. else if(y2 > y1){
  23. y = y2-y1;
  24. }
  25. x = x*x;
  26. y = y*y;
  27. c = x+y;
  28. int l = r1+r2;
  29. l = l*l;
  30. // cout << l << " " << c;
  31. if(l >= c){
  32. cout << "TAK" << "\n";
  33. }
  34. else
  35. cout << "NIE" << "\n";
  36.  
  37. }
  38. return 0;
  39. }
Success #stdin #stdout 0.01s 5284KB
stdin
3
-1 -1 3 2 3 2
0 3 2 3 2 1
1 1 5 2 1 1
stdout
TAK
NIE
TAK