POJ-1182 食物链(NYOJ-207)
摘要:食物链时间限制:1000 ms | 内存限制:65535 KB难度:5描述动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构成的食物链关系进行描述:第一种说法是"1 X Y",表示X和Y是同类。第二种说法是"2 X Y",表示X吃Y。此人对N个动物,用上述两种说法,一句接一句地说出K句话,这K句话有的是真的,有的是假的。当一句话满足下列三条之一时,这句话就是假话,否则就是真话。1) 当前的话
阅读全文
posted @
2013-06-12 21:46
可笑痴狂
阅读(8448)
推荐(2) 编辑
NOI-2002 银河英雄传说
摘要:【问题描述】公元五八○一年,地球居民迁移至金牛座α第二行星,在那里发表银河联邦创立宣言,同年改元为宇宙历元年,并开始向银河系深处拓展。宇宙历七九九年,银河系的两大军事集团在巴米利恩星域爆发战争。泰山压顶集团派宇宙舰队司令莱因哈特率领十万余艘战舰出征,气吞山河集团点名将杨威利组织麾下三万艘战舰迎敌。杨威利擅长排兵布阵,巧妙运用各种战术屡次以少胜多,难免恣生骄气。在这次决战中,他将巴米利恩星域战场划分成30000列,每列依次编号为1, 2, …, 30000。之后,他把自己的战舰也依次编号为1, 2, …, 30000,让第i号战舰处于第i列(i = 1, 2, …, 30000),形成“一字长蛇
阅读全文
posted @
2013-04-25 15:09
可笑痴狂
阅读(1171)
推荐(0) 编辑
POJ-1127 Jack Straws
摘要:Jack StrawsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 2624Accepted: 1183DescriptionIn the game of Jack Straws, a number of plastic or wooden "straws" are dumped on the table and players try to remove them one-by-one without disturbing the other straws. Here, we are only conce
阅读全文
posted @
2012-08-17 15:19
可笑痴狂
阅读(493)
推荐(0) 编辑
HDOJ 1272 小希的迷宫
摘要:小希的迷宫Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14388Accepted Submission(s): 4378Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提
阅读全文
posted @
2012-08-13 16:49
可笑痴狂
阅读(367)
推荐(0) 编辑
POJ -2513 Colored Sticks 字典树 + 并查集 + 欧拉路
摘要:Colored SticksTime Limit: 5000MSMemory Limit: 128000KTotal Submissions: 24844Accepted: 6542DescriptionYou are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such that the colors of the endpoints that touch
阅读全文
posted @
2012-08-10 17:06
可笑痴狂
阅读(235)
推荐(0) 编辑
NYOJ-236 彩色棒 字典树 + 并查集 + 欧拉路
摘要:彩色棒时间限制:1000 ms | 内存限制:128000 KB难度:5描述You are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such that the colors of the endpoints that touch are of the same color?输入the frist line have a number k(0<k&l
阅读全文
posted @
2012-08-09 21:52
可笑痴狂
阅读(348)
推荐(0) 编辑
POJ 2492 A Bug's Life (并查集应用的扩展)
摘要:A Bug's LifeTime Limit: 10000MSMemory Limit: 65536KTotal Submissions: 21637Accepted: 7056DescriptionBackground Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite g
阅读全文
posted @
2012-08-08 11:26
可笑痴狂
阅读(3683)
推荐(0) 编辑
POJ 1703 Find them, Catch them(并查集的扩展应用)
摘要:Find them, Catch themTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 21755Accepted: 6471DescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first needs to identify
阅读全文
posted @
2012-08-08 11:06
可笑痴狂
阅读(334)
推荐(0) 编辑
POJ -2236 Wireless Network
摘要:Wireless NetworkTime Limit: 10000MSMemory Limit: 65536KTotal Submissions: 12151Accepted: 5129DescriptionAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in t
阅读全文
posted @
2012-07-21 10:47
可笑痴狂
阅读(2356)
推荐(0) 编辑
Pku 1611 The Suspects
摘要:The SuspectsDescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to separate the suspects from others. In the Not-Spreading-Your-Sickness Universi
阅读全文
posted @
2012-07-20 12:18
可笑痴狂
阅读(342)
推荐(0) 编辑
Ubiquitous Religions
摘要:Ubiquitous Religions Time Limit : 10000/5000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 2 Accepted Submission(s) : 2Problem DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in...
阅读全文
posted @
2012-07-20 09:49
可笑痴狂
阅读(970)
推荐(0) 编辑
HDOJ-1213 How Many Tables
摘要:#include<stdio.h>int father[1001];int find(int a){ while(father[a]>0) { a=father[a]; } return a;}int main(){ int n,m,t,i,a,b,num; scanf("%d",&t); while(t--) { num=0; scanf("%d%d",&m,&n); for(i=1;i<=m;++i) father[i]=-1; for(i=1;i<=n;++i) { scanf("%d
阅读全文
posted @
2012-06-14 13:10
可笑痴狂
阅读(259)
推荐(0) 编辑
HDOJ-1232 畅通工程
摘要:畅通工程Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15547Accepted Submission(s): 7974Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给
阅读全文
posted @
2012-06-14 10:32
可笑痴狂
阅读(287)
推荐(0) 编辑
NYOJ-42 一笔画问题
摘要:一笔画问题时间限制:3000ms |内存限制:65535KB难度:4描述zyc从小就比较喜欢玩一些小游戏,其中就包括画一笔画,他想请你帮他写一个程序,判断一个图是否能够用一笔画下来。规定,所有的边都只能画一次,不能重复画。输入第一行只有一个正整数N(N 3 #include 4 int p[1005],visit[1005],G[1005][1005]; 5 int point,line; 6 7 void DFS(int i) 8 { 9 int v=i;10 visit[i]=1;11 for(v=0;v 2 #include 3 #include 4 5 ...
阅读全文
posted @
2012-06-04 12:33
可笑痴狂
阅读(911)
推荐(0) 编辑