uva10167
/*
暴力 过了 要使得两半的 樱桃数目相等 去试每一个斜率 还好他这里要的是 A、B
都为正整数 这样范围就锁定在200*100 个点范围内
*/
#include <cstdio>
#include <string.h>
#include <iostream>
using namespace std;
struct point{
int x,y;
}node[110];
void solve(int num)
{
int i;
for(int A=-100;A<=100;A++)
{
for(int B=-100;B<=100;B++){
int L=0,R=0;
for(i=0;i<num;i++){
int d=A*node[i].x+B*node[i].y;
if(d>0)L++;
if(d<0)R++;
if(d==0) break;
}
if(L==num/2&&R==num/2&&i==num){ printf("%d %d\n",A,B);return ; }
}
} }
int main()
{
int num,n,i;
while(scanf("%d",&n)==1){
if(n==0) break;
num=0;
for(i=0;i<n*2;i++){
int a,b;
scanf("%d%d",&a,&b);
if((a*a+b*b)<=10000){
node[num].x=a;
node[num++].y=b;
}
} solve(num);
}
return 0;
}
uva10167的更多相关文章
- uva10167 Birthday Cake
Lucy and Lily are twins. Today is their birthday. Mother buys a birthday cake for them. Now we put t ...
- 备战NOIP每周写题记录(一)···不间断更新
※Recorded By ksq2013 //其实这段时间写的题远远大于这篇博文中的内容,只不过那些数以百记的基础题目实在没必要写在blog上; ※week one 2016.7.18 Monday ...
随机推荐
- 添加Net4CollectionTypeFactory的原因
.NET4.0已经实现了该功能 http://jahav.com/blog/nhibernate-using-net-4-iset/ NHibernate using .NET 4 ISet 0 Co ...
- 数字模型制作规范(转自Unity3D群)
本文提到的所有数字模型制作,全部是用3D MAX建立模型,即使是不同的驱动引擎,对模型的要求基本是相同的.当一个VR模型制作完成时,它所包含的基本内容包括场景尺寸.单位,模型归类塌陷.命名.节点编辑, ...
- Keepalived+Nginx高可用集群
Keepalived简介 Keepalived的作用是检测服务器的状态,如果有一台web服务器宕机,或工作出现故障,Keepalived将检测到,并将有故障的服务器从系统中剔除,同时使用其他服务器代替 ...
- 数据恢复:如何恢复Linux中意外删除的Oracle和MySQL数据库
今天有客户的数据库意外被删除了整个目录中的数据文件,操作系统级别的删除,然而幸运的是这个数据库没有崩溃,仍然处于 open 状态的时候,客户就发现了问题,求助到我们,最终完整地恢复了所有数据文件. 在 ...
- PHPExcel exception: “Could not close zip file … ”报错
Q: PHPExcel exception: “Could not close zip file … ” A:目录没有写权限,chmod 对$phpExcel->save($dir)中报错路径设 ...
- The third column indicates whether subclasses of the class declared outside this package have access to the member.;
总结1.modifier 改性剂 修饰符 修饰语 调节器access modifier 访问修饰符 存取权限 存取修饰词 存取修饰字官网“can”Access level modifiers dete ...
- NTLM
我们介绍Kerberos认证的整个流程.在允许的环境下,Kerberos是首选的认证方式.在这之前,Windows主要采用另一种认证协议——NTLM(NT Lan Manager).NTLM使用在Wi ...
- 新购买的vps应该做的几件事情
1. 修改root密码 passwd root 2.新建用户 useradd vinentguo 3.配置免密码登陆 .使用新建用户登陆vps. mkdir ~/.ssh/ch ...
- Intellij Idea常用配置设置
1.配置Intellij Idea的配置文件从默认c盘转移到其他盘符 找到Intellij idea的安装文件,在bin目录下找到idea.properties配置文件,如下把Idea的配置文件夹和I ...
- 事务控制及try catch
一.事务控制 BEGIN TRY BEGIN TRAN; DECLARE @aaa NVARCHAR(MAX); SET @aaa = 9 / 0; COMMIT TRAN;END TRYBEGIN ...