非常容易的一个题;

只要判断两种基因相差的最小值就行;

 #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std; bool a[],b[];
int x,y; int main()
{
int n,ca=;
while(scanf("%d",&n)==)
{
memset(a,,sizeof a);
memset(b,,sizeof b);
bool flag=;
while(n--)
{
scanf("%d%d",&x,&y);
if(x==y)flag=;
a[x]=;
b[y]=;
}
int mi=;
for(int i=; i<=; i++)
{
if(a[i]==)continue;
for(int j=; j<=; j++)
{
if(b[j]==)continue;
mi=min(mi,abs(i-j));
}
}
if(!flag) mi+=mi==;
printf("Case %d : %d\n", ca++, (mi + )>>);
}
return ;
}

UVA 11737 Extreme Primitive Society的更多相关文章

  1. UVA11737_Extreme Primitive Society

    这是隐藏的最深的一个水题.其隐藏性能如此之好,是因为题目的描述十分蛋疼,写了好多好多的废话. 让我们这种过不了六级的孩子情何以堪啊. 是这样的,给你若干个矩形,每次在所有的矩形中两两组合形成许多许多新 ...

  2. UVA GCD - Extreme (II)

    discription Given the value of N, you will have to find the value of G. The definition of G is given ...

  3. Kung fu

    1. originPeople in Primitive society(原始社会)in order to survive,they have to hunt for food efficiently ...

  4. UVA 11426 - GCD - Extreme (II) (数论)

    UVA 11426 - GCD - Extreme (II) 题目链接 题意:给定N.求∑i<=ni=1∑j<nj=1gcd(i,j)的值. 思路:lrj白书上的例题,设f(n) = gc ...

  5. UVa 11426 - GCD - Extreme (II)

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  6. UVA 11424 GCD - Extreme (I) (欧拉函数+筛法)

    题目:给出n,求gcd(1,2)+gcd(1,3)+gcd(2,3)+gcd(1,4)+gcd(2,4)+gcd(3,4)+...+gcd(1,n)+gcd(2,n)+...+gcd(n-1,n) 此 ...

  7. UVA 11426 GCD - Extreme (II) (欧拉函数)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Problem JGCD Extreme (II)Input: Standard ...

  8. UVa 11426 (欧拉函数 GCD之和) GCD - Extreme (II)

    题意: 求sum{gcd(i, j) | 1 ≤ i < j ≤ n} 分析: 有这样一个很有用的结论:gcd(x, n) = i的充要条件是gcd(x/i, n/i) = 1,因此满足条件的x ...

  9. UVA 11426 GCD - Extreme (II) (欧拉函数+筛法)

    题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=70017#problem/O 题意是给你n,求所有gcd(i , j)的和,其中 ...

随机推荐

  1. [记录] nicescroll 在bootstrap tabs中工作

    Operlapping Nicescroll scrolbars in Bootstrap tabs 因为我的tab是指定id的 <!-- Nav tabs --> <ul clas ...

  2. xampp 安装后无法启动apache 的解决方法

    1,安装xampp 后,apache 无法启动,当时的报错已经没有证据了,大概的翻译就是端口 被block(锁定)的意思 2,通过 查找端口被占用,找到被占用程序,进行杀掉进程,或者卸载软件,参考网址 ...

  3. orcale授权

    grant connect,resource,dba to 表名;--用户授权 CONNECT角色: --是授予最终用户的典型权利,最基本的 CREATE SESSION --建立会话 RESOURC ...

  4. spark stream初探

    spark带了一个NetworkWordCount测试程序,用以统计来自某TCP连接的单词输入: /usr/local/spark/bin/run-example streaming.NetworkW ...

  5. ios registerNib: and registerClass:

    先看看apple官网简述: registerNib:forCellWithReuseIdentifier: Register a nib file for use in creating new co ...

  6. 从零开始部署小型企业级虚拟桌面 -- Vmware Horizon View 6 For Linux VDI -- 结构规划

    环境说明 注,本套环境所用机器全部是64位的. 管理服务器载体:安装win7操作系统,通过VMware Workstation安装4台虚拟机,用作vCenter,Connection Server,D ...

  7. Golang,用map写个单词统计器

    Golang中也有实用的泛型编程模板.如map.据Go官方团队称,其实现为Hash表,而非类似cpp或Java的红黑树.所以理论上速度更能快上几个等级(Hash与红黑树的效率对比可以看我的文章C++中 ...

  8. Java获取方法参数名、Spring SpEL解析

    @Test public void testParse() { //表达式解析 ExpressionParser expressionParser = new SpelExpressionParser ...

  9. HDU 4762 Cut the Cake

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762 题目大意:将n个草莓随机放在蛋糕上,草莓被看做是点,然后将蛋糕平均切成m份,求所有草莓在同一块蛋 ...

  10. spring常用的连接池属性文件配置

    (一) DBCP 引入jar文件 commons-dbcp-1.2.1.jar commons-pool-1.3.jar二个包. spring配置文件 <bean id="dataSo ...