Time Limit: 5000MS   Memory Limit: 32768KB   64bit IO Format: %lld & %llu

Submit
Status

Description

In a 2D plane N persons are standing and each of them has a gun in his hand. The plane is so big that the persons can be considered as points and their locations are given as Cartesian coordinates. Each of the
N persons fire the gun in his hand exactly once and no two of them fire at the same or similar time (the sound of two gun shots are never heard at the same time by anyone so no sound is missed due to concurrency). The hearing ability of all
these persons is exactly same. That means if one person can hear a sound at distance
R1, so can every other person and if one person cannot hear a sound at distance
R2 the other N-1 persons cannot hear a sound at distance
R2 as well.

The N persons are numbered from 1 to
N
. After all the guns are fired, all of them are asked how many gun shots they have heard (not including their own shot) and they give their verdict. It is not possible for you to determine whether their verdicts are true but it is possible for you
to judge if their verdicts are consistent. For example, look at the figure above. There are five persons and their coordinates are (1, 2), (3, 1), (5, 1), (6, 3) and (1, 5) and they are numbered as 1, 2, 3, 4 and 5 respectively. After all five of them have
shot their guns, you ask them how many shots each of them have heard. Now if there response is 1, 1, 1, 2 and 1 respectively then you can represent it as (1, 1, 1, 2, 1). But this is an inconsistent verdict because if person 4 hears 2 shots then he must have
heard the shot fired by person 2, then obviously person 2 must have heard the shot fired by person 1, 3 and 4 (person 1 and 3 are nearer to person 2 than person 4). But their opinions show that Person 2 says that he has heard only 1 shot. On the other hand
(1, 2, 2, 1, 0) is a consistent verdict for this scenario so is (2, 2, 2, 1, 1). In this scenario (5, 5, 5, 4, 4) is not a consistent verdict because a person can hear at most 4 shots.

Given the locations of N persons, your job is to find the total number of different consistent verdicts for that scenario. Two verdicts are different if opinion of at least one person is different.

Input

Input starts with an integer T (≤ 100), denoting the number of test cases.

Each case starts with a line containing a positive integer N (1 ≤ N ≤ 700). Each of the next
N lines contains two integers xi yi (0 ≤ xi, yi ≤ 30000) denoting a co-ordinate of a person. Assume that all the co-ordinates are distinct.

Output

For each case, print the case number and the total number of different consistent verdicts for the given scenario.

Sample Input

2

3

1 1

2 2

4 4

2

1 1

5 5

Sample Output

Case 1: 4

Case 2: 2

Source

Problem Setter: Shahriar Manzoor
Special Thanks: Jane Alam Jan

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
struct zz
{
int x;
int y;
}q[1500];
double dis[710][710];
double dd[710];
double d[710];
double ju(zz a,zz b)
{
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
int main()
{
int t;
int T=1;
int n,m;
int i,j;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d%d",&q[i].x,&q[i].y);
int k=0;
for(i=1;i<n;i++)
{
for(j=i+1;j<=n;j++)
{
dd[k++]=ju(q[i],q[j]);
}
}
sort(dd,dd+k);
j=1;
for(i=1;i<k;i++)
{
if(dd[i]!=dd[i-1])
{
j++;
}
}
printf("Case %d: %d\n",T++,j+1);
}
return 0;
}

最新文章

  1. 美团HD(3)-加载分类导航数据
  2. SpringMVC注入Spring的bean
  3. GDB常用命令
  4. 【转】maven命令背后是如何工作的
  5. 【C#】用C#通过读取数据库方式读取CSV文件
  6. JSP页面上用横线代替文本框
  7. Javascript 基础编程练习一
  8. Android MediaCodec硬编兼容性测试方案
  9. shell脚本 字串截取 正则表达式
  10. bzoj3963[WF2011]MachineWorks cdq分治+斜率优化dp
  11. 文件操作(open\read\write\close)
  12. 转:禁止360随身wifi驱动自动安装
  13. android notification,notificationmanager详解
  14. 并发编程(五):CAS
  15. python基础知识总结(一)
  16. 一个小错误:error LNK2019: 无法解析的外部符号 &quot;public: __thiscall Turtle::~Turtle(void)&quot; (??1Turtle@@QAE@XZ),该符号在函数 _main 中被引用
  17. 代码中特殊的注释技术——TODO、FIXME和XXX的用处(转)
  18. CentOS 7 yum安装zabbix 设置中文界面
  19. tiny4412 --uboot移植(1)
  20. tomcat查看并修改jvm大小

热门文章

  1. BZOJ 1061费用流
  2. 第5章分布式系统模式 使用客户端激活对象通过 .NET Remoting 实现 Broker
  3. 2019苏州凯美瑞德Java开发面试
  4. jq+mui 阻止事件冒泡
  5. WPF 解决拼接屏全屏的问题
  6. tomcat_logs
  7. facebook atc弱网环境搭建和踩坑总结
  8. .bat 打开程序
  9. Bind for 0.0.0.0:80 failed: port is already allocated.解决方案
  10. Python学习笔记(2)操作符和数据类型