2011年7月29日

摘要: DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your university believe in. You know that there are n students in your university (0 < n <= 50000). It 阅读全文
posted @ 2011-07-29 10:50 Raffaello 阅读(162) 评论(0) 推荐(0)
 
摘要: Problem DescriptionThe famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure.The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made a plan to reform its system. The reform includes mov 阅读全文
posted @ 2011-07-29 10:49 Raffaello 阅读(212) 评论(0) 推荐(0)
 
摘要: DescriptionSevere 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 University (NSYSU), 阅读全文
posted @ 2011-07-29 10:49 Raffaello 阅读(122) 评论(0) 推荐(0)
 
摘要: Problem DescriptionHere is a famous story in Chinese history."That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and others.""Both of Tian and the king have three horses in different classes, namely, regula 阅读全文
posted @ 2011-07-29 10:49 Raffaello 阅读(187) 评论(0) 推荐(0)
 
摘要: 三个函数void Make_set(int x){ int i; for(i=0;i<x;i++) { father[i]=i; num[i]=1; }}int Find_set(int x){ if(father[x]!=x) { father[x]=Find_set(father[x]); } return father[x];}void Union(int x,int y){ int a,b; a=Find_set(x); b=Find_set(y); if(a==b) return; if(num[a]>num[b]) { father[b]=a; num[a]+=num[ 阅读全文
posted @ 2011-07-29 10:49 Raffaello 阅读(111) 评论(0) 推荐(0)
 
摘要: Problem DescriptionCrixalis - Sand King used to be a giant scorpion(蝎子) in the deserts of Kalimdor. Though he's a guardian of Lich King now, he keeps the living habit of a scorpion like living underground and digging holes.Someday Crixalis decides to move to another nice place and build a new ho 阅读全文
posted @ 2011-07-29 10:48 Raffaello 阅读(162) 评论(0) 推荐(0)
 
摘要: Problem DescriptionIgnatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after the deadline, the teacher will reduce his score of the final test. And now we assum 阅读全文
posted @ 2011-07-29 10:47 Raffaello 阅读(155) 评论(0) 推荐(0)
 
摘要: 并查集学习:l 并查集:(union-find sets)一种简单的用途广泛的集合. 并查集是若干个不相交集合,能够实现较快的合并和判断元素所在集合的操作,应用很多,如其求无向图的连通分量个数等。最完美的应用当属:实现Kruskar算法求最小生成树。l 并查集的精髓(即它的三种操作,结合实现代码模板进行理解):1、Make_Set(x) 把每一个元素初始化为一个集合初始化后每一个元素的父亲节点是它本身,每一个元素的祖先节点也是它本身(也可以根据情况而变)。2、Find_Set(x) 查找一个元素所在的集合查找一个元素所在的集合,其精髓是找到这个元素所在集合的祖先!这个才是并查集判断和合并的最终 阅读全文
posted @ 2011-07-29 10:47 Raffaello 阅读(131) 评论(0) 推荐(0)
 
摘要: 说实在的,不喜欢这个名字,太过伤感。可是却再想不出更贴切的标题。翻阅人人早已成为冷落太久的习惯,从未想过又一个学期的落幕后,这篇日志仍会给我带来不减当初的内心震撼,不,更准确的说应该是不甘.....大一下学期以同样速度的消逝,承认这学期学到了些东西,但是还是有太多的遗憾......给自己一个看似不可能的梦想,一定会成为奋斗的发动机.....在这里,在此时,种下这颗叫做梦想的种子,我期待,它会在未来,在我的世界里上演! 阅读全文
posted @ 2011-07-29 10:46 Raffaello 阅读(119) 评论(0) 推荐(0)
 
摘要: 描述一个数的序列bi,当b1 < b2 < ... < bS的时候,我们称这个序列是上升的。对于给定的一个序列(a1, a2, ..., aN),我们可以得到一些上升的子序列(ai1, ai2, ..., aiK),这里1 <= i1 < i2 < ... < iK <= N。比如,对于序列(1, 7, 3, 5, 9, 4, 8),有它的一些上升子序列,如(1, 7), (3, 4, 8)等等。这些子序列中最长的长度是4,比如子序列(1, 3, 5, 8).你的任务,就是对于给定的序列,求出最长上升子序列的长度。输入输入的第一行是序列的长度N 阅读全文
posted @ 2011-07-29 10:40 Raffaello 阅读(278) 评论(0) 推荐(0)