博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Lightoj 1018 - Brush (IV)
阅读量:5108 次
发布时间:2019-06-13

本文共 2755 字,大约阅读时间需要 9 分钟。

1018 - Brush (IV)
  
Time Limit: 2 second(s) Memory Limit: 32 MB

Mubashwir returned home from the contest and got angry after seeing his room dusty. Who likes to see a dusty room after a brain storming programming contest? After checking a bit he found an old toothbrush in his room. Since the dusts are scattered everywhere, he is a bit confused what to do. So, he called Shakib. Shkib said that, 'Use the brush recursively and clean all the dust, I am cleaning my dust in this way!'

So, Mubashwir got a bit confused, because it's just a tooth brush. So, he will move the brush in a straight line and remove all the dust. Assume that the tooth brush only removes the dusts which lie on the line. But since he has a tooth brush so, he can move the brush in any direction. So, he counts a move as driving the tooth brush in a straight line and removing the dusts in the line.

Now he wants to find the maximum number of moves to remove all dusts. You can assume that dusts are defined as 2D points, and if the brush touches a point, it's cleaned. Since he already had a contest, his head is messy. That's why he wants your help.

Input

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

Each case starts with a blank line. The next line contains three integers N (1 ≤ N ≤ 16)N means that there are N dust points. Each of the next N lines will contain two integers xi yi denoting the coordinate of a dust unit. You can assume that (-1000 ≤ xi, yi ≤ 1000) and all points are distinct.

Output

For each case print the case number and the minimum number of moves.

Sample Input

Output for Sample Input

2

 

3

0 0

1 1

2 2

 

3

0 0

1 1

2 3

Case 1: 1

Case 2: 2

 

/* ***********************************************Author        :guanjunCreated Time  :2016/6/22 20:44:30File Name     :1018.cpp************************************************ */#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define ull unsigned long long#define ll long long#define mod 90001#define INF 0x3f3f3f3f#define maxn 1000010#define cle(a) memset(a,0,sizeof(a))const ull inf = 1LL << 61;const double eps=1e-5;using namespace std;int dp[maxn],n,l[20][20];struct node{ int x,y;}nod[20];bool Gx(node a,node b,node c){ //int tmp=(a.x*b.y-a.y*b.x)+(b.x*c.y-b.y*c.x)+(c.x*a.y-c.y*a.x); //if(tmp==0)return true; if((a.x-b.x)*(c.y-b.y)-(a.y-b.y)*(c.x-b.x)==0)return true; return false;}int dfs(int s){ if(dp[s]!=INF)return dp[s]; int cnt=0; for(int i=0;i
<
>T; for(int t=1;t<=T;t++){ cin>>n; for(int i=0;i

 

转载于:https://www.cnblogs.com/pk28/p/5608686.html

你可能感兴趣的文章
Dirichlet分布深入理解
查看>>
(转)Android之发送短信的两种方式
查看>>
字符串处理
查看>>
HtmlUnitDriver 网页内容动态抓取
查看>>
ad logon hour
查看>>
获得进程可执行文件的路径: GetModuleFileNameEx, GetProcessImageFileName, QueryFullProcessImageName...
查看>>
证件照(1寸2寸)拍摄处理知识汇总
查看>>
罗马数字与阿拉伯数字转换
查看>>
Eclipse 反编译之 JadClipse
查看>>
Python入门-函数
查看>>
[HDU5727]Necklace(二分图最大匹配,枚举)
查看>>
距离公式汇总以及Python实现
查看>>
设计模式之装饰者模式
查看>>
一道不知道哪里来的容斥题
查看>>
Blender Python UV 学习
查看>>
window添加右键菜单
查看>>
入手腾龙SP AF90mm MACRO
查看>>
Window7上搭建symfony开发环境(PEAR)
查看>>
Linux内核态、用户态简介与IntelCPU特权级别--Ring0-3
查看>>
第23月第24天 git命令 .git-credentials git rm --cached git stash clear
查看>>