因为一个小错 不过  好不爽........

#include <iostream>
#include <fstream>
using namespace std;
struct Node
{
int x, y;
};
class shap
{
public:
int num;
Node dian[22];
} q[22];
double getk(int x1, int y1, int x2, int y2)
{
return (double)(y1-y2)/(double)(x1-x2);
}
double esp = 1e-7;
int main(void)
{
// freopen("1.txt", "r", stdin);
int kase;
cin>>kase;
int n;
int count = 1;
while(kase-- && cin>>n)
{
int m;
for(int i = 0; i < n; i++)
{
cin>>m;
q[i].num = m;
for(int j = 0; j < m; j++)
cin>>q[i].dian[j].x>>q[i].dian[j].y;
}
if(n <= 2)
{
printf("Case %d: %d\n", count++, n);
continue;
}
int _max = 2;
for(int i = 0; i < n; i++)
{
for(int j = i+1; j < n; j++)
{
for(int k = 0; k < q[i].num; k++)
{
for(int g = 0; g < q[j].num; g++)
{
int a = q[i].dian[k].x;
int b = q[i].dian[k].y; int c = q[j].dian[g].x;
int d = q[j].dian[g].y; int cnt = 2;
if(a == c)
{
for(int ii = 0; ii < n; ii++)
{
if(ii == i || ii == j)
continue;
int x = a;
int ok = q[ii].dian[0].x < x? -1:1; if(q[ii].dian[0].x == x)
{
cnt++;
continue;
}
//0表示点在下方
for(int jj = 1; jj < q[ii].num; jj++)
{
int pos = q[ii].dian[jj].x < x? -1:1;
if(q[ii].dian[jj].x == x)
{
cnt++;
break;
}
if(ok * pos == -1)
{
cnt++;
break;
}
}
}
continue;
}
double k = getk(a, b, c, d);
double bi = b - k*a; //枚举第三个多边形
for(int ii = 0; ii < n; ii++)
{
if(ii == i || ii == j)
continue;
//0表示点在下方
if(k*q[ii].dian[0].x + bi - q[ii].dian[0].y == 0)
{
cnt++;
continue;
}
int ok = k*q[ii].dian[0].x + bi - q[ii].dian[0].y < 0? -1:1;
for(int jj = 1; jj < q[ii].num; jj++)
{
int pos = k*q[ii].dian[jj].x + bi - q[ii].dian[jj].y < 0? -1:1;
if(k*q[ii].dian[jj].x + bi - q[ii].dian[jj].y == 0)
{
cnt++;
break;
}
if(ok * pos == -1)
{
cnt++;
break;
}
}
}
_max = max(cnt, _max);
}
}
}
}
printf("Case %d: %d\n", count++, _max);
} return 0;
}

hdu 3952的更多相关文章

  1. hdu - 3952 Fruit Ninja(简单几何)

    思路来自于:http://www.cnblogs.com/wuyiqi/archive/2011/11/06/2238530.html 枚举两个多边形的两个点组成的直线,判断能与几个多边形相交 因为最 ...

  2. HDU——1130 How Many Trees?

    How Many Trees? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  3. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  4. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  5. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  6. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  7. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  8. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

  9. hdu 4481 Time travel(高斯求期望)(转)

    (转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...

随机推荐

  1. SQL数据库设计三范式

    关系型数据库将数据库设计需要遵循的一些规则叫做“范式”,最基本的三个范式(1NF.2NF.3NF)简称三范式.第一范式是满足第二范式的基础,而第一.二范式又是满足第三范式的基础. 第一范式 表中的字段 ...

  2. asp.net php asp jsp 301重定向的代码

    介绍一下针对各类程序系统实施301重定向的代码: 1.Linux主机重定向 Godaddy的Liunx主机,Godaddy本身已经支持Apache,所以直接创建一个.htaccess文件就可以了,一般 ...

  3. SQLSERVER2012数据库还原

    (1)还原已存在数据库 还原时提示失败,因为数据库正在使用,无法获得独占访问权.解决办法,先分离已存在的数据库,再执行还原操作. 确定后居然成功了,因为我是先使用(2)还原数据库后直接尝试(1)方法还 ...

  4. asp.net发布webservice出现‘Could not write to output file ‘解决办法

    Could not write to output file 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET File ...

  5. Oracle 简介 三层结构

    引言: 主流数据库:sql server, oracle, my sql,IBM公司的DB2 ,oracle占有量很大 dbms(database management system)数据库管理系统 ...

  6. swift闭包传值

    不知道原理,就知道这么用的,皮毛上的那一点. 寻思着把以前的项目改成swift的,结果了,,, 反向传值 一. //类似于OC中的typedef typealias sendValueClosure= ...

  7. 在swift中使用oc 的代码

    就是需要一个桥文件, 方法一:在swift项目中,新建一个oc的类,这时候,会弹出一个对话框,你点默认的那个选项就行了.然后在新生成的桥文件中导入你所需要的oc代码的头文件就行了. 方法二:但是有时候 ...

  8. 我的博客已搬迁到http://www.lsworks.net

    我的博客已搬迁到http://www.lsworks.net

  9. 致vi老大 2011.1

    文/安然 亲爱的,你即将离去 飞机起飞的一刻, 请珍藏起我们2010的回忆 桃源仙谷,曾留下我们踏青的足迹 难忘,石头上小憩 小北门外,我们在大排档里尽情欢喜 见证,杯盘狼藉 饺子店,是冬日里四面八方 ...

  10. SecureCRT for Linux突破30天使用限制

    当然还有一种方法,就是当你试用点i agree到时候,在~/.vandyke/Config 会生成一个文件SecureCRT_eval.lic,删除以后就可以恢复30天试用