暴力搜索

 #include<cstdio>

 struct node
{
int x;
int y;
}s[];
int main()
{
//freopen("input.txt","r",stdin);
int a,b,n,num;
int i;
bool flag;
while(scanf("%d",&n) && n)
{
for(i = ; i < * n; i++)
scanf("%d%d",&s[i].x,&s[i].y);
flag = ;
for(a = - ; a <= ; a++)
{
for(b = -; b <= ; b++)
{
num = ;
if(a == && b == ) continue;
for(i = ; i < * n; i++)
{
if(a * s[i].x + b * s[i].y > ) num++;
if(a * s[i].x + b * s[i].y == ) break;
}
if(i == * n && num == n)
{
flag = ;
break;
}
}
if(flag) break;
}
printf("%d %d\n",a,b);
} return ;
}

UvaOJ 10167的更多相关文章

  1. (Step1-500题)UVaOJ+算法竞赛入门经典+挑战编程+USACO

    http://www.cnblogs.com/sxiszero/p/3618737.html 下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年 ...

  2. uvaoj 10397 - Connect the Campus【最小生成树】

    uvaoj 10397 - Connect the Campus Many new buildings are under construction on the campus of the Univ ...

  3. 【原创】UVAOJ水题10025解题报告

    首先是原题,转自UVAOJ  The ? 1 ? 2 ? ... ? n = k problem  The problem Given the following formula, one can s ...

  4. UVAoj 348 - Optimal Array Multiplication Sequence

    /* 题意:矩阵相乘的最少的步数 dp[i][j]=min(dp[i][j], dp[i][k]+dp[k+1][j]+num[i-1]*num[k]*num[j]); 表示的是第i个矩阵到第j个矩阵 ...

  5. Uvaoj 10048 - Audiophobia(Floyd算法变形)

    1 /* 题目大意: 从一个点到达另一个点有多条路径,求这多条路经中最大噪音值的最小值! . 思路:最多有100个点,然后又是多次查询,想都不用想,Floyd算法走起! */ #include< ...

  6. Uvaoj 11624 - Fire!

    /************************************************************************* > File Name: test.cpp ...

  7. UVAoj 11324 - The Largest Clique(tarjan + dp)

    题意:给定一个有向图,寻找一个点数最大集合,使得这个集合中的任意两个点 u,v, 都有u->v 或者 v->u 或者u<==>v 思路:首先将强连通分量通过tarjan算法求出 ...

  8. Uvaoj 11248 Frequency Hopping(Dinic求最小割)

    题意:1到n节点(节点之间有一定的容量),需要流过C的流量,问是否可以?如果可以输出possible, 否则如果可以扩大任意一条边的容量 可以达到目的,那么输出possible option:接着输出 ...

  9. Brute Force --- UVA 10167: Birthday Cake

     Problem G. Birthday Cake  Problem's Link:http://uva.onlinejudge.org/index.php?option=com_onlinejudg ...

随机推荐

  1. 判断\r\n结束标准

    ucPrev==0x0D&&ucCur==0x0A \r\n uint8_t ucPrev =0,ucCur = 0; uint32_t recvlen = 0; for (; uiL ...

  2. 接口没添加@responseBody注解

    今天在重写springaop小demo时,发现调用接口时,可以在控制台上正常返回结果,但是页面报错,debug半天,可以看到是调用了modelview的时候出错,找不到视图了.. debug的时候控制 ...

  3. 【Java】生成图形验证码

    本章介绍一个能生成比较好看的图形验证码类 生成验证码工具类 package com.util; import java.awt.Color; import java.awt.Font; import ...

  4. centos7 虚拟机安装docker-ce-17.09

    1.创建虚拟机使用iso镜像centos-x86_64-7.3.1611 2.安装centos选择桌面版 3.配置命令行环境,网卡(见博客另一篇文章) 4.安装container-selinux-2. ...

  5. C++中string的使用

    概述 这篇博文为了记录C++中string的使用,用到一点补充一点. 预备 使用string之前需要包含头文件 #include<iostream> #include<string& ...

  6. 证明 U and V={0}时 dim(U+V)=dim(U)+dim(V)

    U And V={0} 证明 dim(U+V)=dim(U)+dim(V)设{u1,u2,...,uk} 是U的基,{v1,v2...,vr}是V的基,dim(U)=k ,dim(V)=r dim(U ...

  7. aliyun API 调试

    打开https://ai.aliyun.com/,登录阿里云账号,选择控制台,右侧标签中选择产品服务,选择自己需要的子标签(如图像识别),选择API调试,按要求填写表格. 其中请求Body参照API文 ...

  8. boost-智能指针

    使用boost的智能指针需要包含头文件"boost/smart_ptr.hpp",c++11中需要包含头文件<memory> 1.auto_ptr.scoped_ptr ...

  9. C++STL queue

    queue队列 先进先出 queue<int> q1; q1.push();//插入元素 q1.front();//求队头元素 q1.pop();//删除队头元素 q1.empty();/ ...

  10. Linux下启动tomcat报错,WARN org.apache.zookeeper.ClientCnxn - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException:

    tomcat启动完了之后,一直不停的打印这种错误信息,看表面上,应该是zk节点下的数据是空的,连接不上服务,所以一直在尝试连接,然后一直又连不上: 完整的错误信息: 407662 [usf-ZooKe ...