CSU1614:First Blood
来源:互联网 发布:mac 查杀进程 编辑:程序博客网 时间:2024/05/22 16:00
Description
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?
Input
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.
Output
For each test case, output an integer indicating the answer.
Sample Input
231 -1 710 -7 5-9 -4 136 2 8-10 1 5-2 2 7
Sample Output
10
HINT
Source
#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; }
- CSU1614:First Blood
- First blood...
- First blood...
- First Blood
- first blood
- first blood
- first blood
- first blood!
- First blood
- First Blood
- first blood
- First Blood
- first blood
- first blood
- First Blood
- first blood!
- FIRST BLOOD
- first blood
- 交换*号到第一位的partition算法和不改变数字位置的算法 scala版本
- android studio慢慢熟悉-好用的 设置 查找框
- 彻底分析block中的循环引用
- UVA LA3890 二分和半平面交
- python中出现的expected an indented block错误代码解析
- CSU1614:First Blood
- 剑指offer 替换空格 java实现
- Leecode记录——Valid Palindrome
- day14/ArrayListTest2.java
- C++命名空间的解释
- 关于SmartForm和ScriptForm的输出格式设置说明
- day14/ArrayListTest.java
- jsp的EL表达式中建立链接隐藏id,点击链接进入新页面,显示详细信息
- day14/CollectionDemo.java