非常容易的一个题;

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

 #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. NoSQL选型

    传统“关系型数据库”在应付互联网WEB2.0应用已显示的力不从心,由其是超大规模和高并发的SNS类型的WEB2.0网站.主要需要应对以下三方面难题: 1.对数据库高并发读写的要求. 2.对数据库高可扩 ...

  2. li 水平排列并自动填满 ul

    找了li 如何水平排列并自动填满 ul,同时 li 宽度平均?资料,里面有提到"请用js动态计算保证兼容性", 因为我想实现的是,水平滚动条,ul的上级div是固定的宽度1000p ...

  3. ASP判断文件地址是否有效

    <% Response.Write("<head><style><!--span{ font-size: 9pt }--></style> ...

  4. VMware下LINUX的虚拟机增加磁盘空间

    先关闭虚拟机电源,做如下设置:“ 虚拟机”--“虚拟机设置”--“磁盘”--“扩展” 可以随意添加你需要增到到的磁盘大小(如15Gb,表示磁盘总量,包含原来的磁盘容量); 再重启电源进入系统做如下步骤 ...

  5. Centos7最小化安装后(minimal)安装图形界面

    centos7下载地址:http://mirrors.cqu.edu.cn/CentOS/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso 下载后用vmwa ...

  6. UDP 广播 Java

    1.服务端 public class UdpBroadcastServer { /** * @param args */ public static void main(String[] args) ...

  7. Container容器控件的使用、Hbox与Vbox布局管理器的使用、以及AjaxAction前后台事件响应

    1.由于有前后台交互功能,需要在Spring上下文中注册一个用于提供服务的bean,对于这个bean使用Spring提供的@Component标注,如果需要使用@Component注解,需要在项目中W ...

  8. How to: Extract files from a compiled setup.exe created by Inno setup

    Use innounp.exe to unpack setup.exe created by using Inno setup: for example, unpack all the files w ...

  9. Python3 正则表达式

    字符串是编程时涉及到的最多的一种数据结构,对字符串进行操作的需求几乎无处不在.比如判断一个字符串是否是合法的Email地址,虽然可以编程提取@前后的子串,再分别判断是否是单词和域名,但这样做不但麻烦, ...

  10. 发光的input框(纯css实现)

    css代码: input{width: 200px;height: 40px;} input.focus{border-color: #08c;box-shadow: 0 0 4px #8bd6fb; ...