非常容易的一个题;

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

 #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. .Net 两个对像之间的映射

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  2. 【MINA】心跳机制

    列上两篇好文章 http://www.cnblogs.com/pricks/p/3832882.html http://blog.csdn.net/cruise_h/article/details/1 ...

  3. Masonry 控件详解

    1.   Masonry的属性 @property (nonatomic,strong,readonly)MASConstraint *left; //左侧 @property(nonatomic,s ...

  4. iOS App Transport Security

    网络请求提示:Application Transport Security has blocked a cleartext HTTP (http://) resource load since it ...

  5. C#中常用修饰符

    1.存取修饰符 public:(公有的)存取不受限制 protected:(受保护的)只有包含该成员的类以及派生类可以存取  private:(私有的)只有包含该成员的类可以使用 2.类修饰符 abs ...

  6. JavaScript中的apply与call与arguments对象

    (一) call方法 语法:presentObj.call(thisObj,arg1,arg2,arg3...) 参数thisObj :将被用作当前对象presentObj的对象. 当thisObj无 ...

  7. 修改placeholder颜色

    #contact_info为textarea的ID #contact_info::-webkit-input-placeholder{ color:#999;}#contact_info:-moz-p ...

  8. Wix: Using Patch Creation Properties - Small Update

    Source Reference: wix help document  -- WiX Toolset License Using Patch Creation Properties  A patch ...

  9. 转:基于IOS上MDM技术相关资料整理及汇总

    一.MDM相关知识: MDM (Mobile Device Management ),即移动设备管理.在21世纪的今天,数据是企业宝贵的资产,安全问题更是重中之重,在移动互联网时代,员工个人的设备接入 ...

  10. Windows Phone 动态改变ListBox样式

    使用ListBox时通常会借助ItemTemplate帮助我们实现更复杂多样的样式显示,体现了Xaml的灵活.如何动态改变变ListBox的样式,实现类似电脑资源管理器中列表显示和图标显示形式的替换. ...