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 ...
随机推荐
- 【转】CCScale9Sprite和CCControlButton
转自:http://blog.csdn.net/nat_myron/article/details/12975145 在2dx下用到了android下的.9.png图片,下面是原图 查了一下2dx ...
- Jdk提供的动态代理示例
package com.jiaoyiping.util.demo; import java.lang.reflect.InvocationHandler; import java.lang.refle ...
- like to do vs like doing
I like to eat apple 表示我喜欢吃苹果这种食物. I like eating apple 表示我喜欢吃苹果这种食物 或者 表示我喜欢吃苹果这个过程. like to do,表达的是倾 ...
- 在 arc里面打印 引用计数的方法
查阅资料: You can use CFGetRetainCount with Objective-C objects, even under ARC: NSLog(@"Retain c ...
- vue--引入富文本编辑器
https://blog.csdn.net/div_ma/article/details/79536634 // 使用 https://blog.csdn.net/div_ma/article/det ...
- thinkCMF----自定义配置调用
有些时候,需要在后台给网站一些其他的配置: 这个配置,一般都是通过修改代码实现的,ThinkCMF本身没有这个配置: 找到site.html 增加一个Group就可以: 在配置里面做相应的配置就可以:
- Django---项目如何创建
首先是安装好Django,找到 Scripts 目录配置环境变量: 只要添加到环境变量,在任何目录执行 django-admin startproject mysite 就可以创建 Django 程序 ...
- mysql count(*) 和count(列) 的区别
count(*) 是统计包含null的记录,而count(列)不含null; 在不带where的情况下count(*)与count(列)相比,并非统计所有列,而是忽略所有列而直接统计行数; 当coun ...
- PKCS 发布的15 个标准与X509
PKCS 发布的15 个标准,转自:http://falchion.iteye.com/blog/1472453 PKCS 全称是 Public-Key Cryptography Standards ...
- is_file file_exists microtime performance
对项目中旧代码的疑问 } elseif (substr($class_name, 0, 6) == 'OAuth2') { $file_name = $C->INCPATH . 'classes ...