Zuosige always has bad luck. Recently, he is in hospital because of pneumonia. While he is taking his injection, he feels extremely bored. However, clever Zuosige comes up with a new game.
Zuosige draws some circles randomly on the paper and he wants to know how many circles have no common points with others. If a circle have no common points with another circle, they must be out of each other. This is such a simple problem and can you help
him?
The first line contains one integer T, indicating the number of test cases.
In one test case, there are several lines.
In the first line, there are an integer N (2<=N<=100), indicating the number of circles.
In the following N lines, there are three integers xi, yi, ri (0<=|xi|, |yi|<=1000, 1<=ri<=1000), indicating the coordinates and the radius of the i-th circle.
For each test case, output an integer indicating the answer.
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
#define ls 2*i
#define rs 2*i+1
#define up(i,x,y) for(i=x;i<=y;i++)
#define down(i,x,y) for(i=x;i>=y;i--)
#define mem(a,x) memset(a,x,sizeof(a))
#define w(a) while(a)
#define LL long long
const double pi = acos(-1.0);
#define N 50005
#define mod 19999997
const int INF = 0x3f3f3f3f;
#define exp 1e-8
struct node
{
int x,y,r;
}a[105];
bool vis[105][105];
int main()
{
int i,j,k,t,n;
cin >> t;
w(t--)
{
cin >> n;
up(i,0,n-1)
scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].r);
mem(vis,false);
up(i,0,n-1)
{
up(j,0,n-1)
{
int t1 = (a[i].x-a[j].x)*(a[i].x-a[j].x)+(a[i].y-a[j].y)*(a[i].y-a[j].y);
int t2 = (a[i].r+a[j].r)*(a[i].r+a[j].r);
if(t1>t2) vis[i][j]=vis[j][i] = true;
}
}
int ans = 0,flag;
up(i,0,n-1)
{
flag = 0;
up(j,0,n-1)
{
if(i!=j && !vis[i][j]) flag = 1;
}
if(!flag)
ans++;
}
cout<<ans<<endl;
}
return 0;
}