09 2011 档案
摘要:Tempter of the Bone IITime Limit: 10000/5000 MS (Java/Others)Memory Limit: 98304/32768 K (Java/Others)Total Submission(s): 704Accepted Submission(s): 160Problem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze was changed and
阅读全文
摘要:水题,首先把两个数组的的长度设为一样的,即空位补零,数字在数组中以右对齐方式存储。 代码如下: 1 #include <cstdlib> 2 #include <cstring> 3 #include <cstdio> 4 using namespace std; 5 6 int main() 7 { 8 char a[10], b[10], aa[10], bb[10]; 9 int bit, num1, num2;10 while( 1 )11 {12 memset( a, '0', sizeof( a ) );13 ...
阅读全文
摘要:前面用二维线段树写了个,代码长不说,而且效率还慢的要死!!!!! Orz...... 这题如果用树状数组来解的话,代码量很小而且速度很快。二维树状数组就在循环上面再加一层循环。 代码如下:#include <cstdlib>#include <cstdio>#include <cstring>#define LOWBIT( x ) (x) & -(x)using namespace std;int rec[1040][1040], N;inline void CinInt( int &t ){ char f = 1, c; while( c
阅读全文
摘要:Luck and LoveTime Limit: 10000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2438Accepted Submission(s): 627Problem Description世界上上最远的距离不是相隔天涯海角而是我在你面前可你却不知道我爱你―― 张小娴前段日子,枫冰叶子给Wiskey做了个征婚启事,聘礼达到500万哦,天哪,可是天文数字了啊,不知多少MM蜂拥而至,顿时万人空巷,连扫地的大妈都来凑热闹来了。―_―|||由于人数太多,Wiskey
阅读全文
摘要:Mobile phonesTime Limit:5000MSMemory Limit:65536KTotal Submissions:9263Accepted:4154DescriptionSuppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares form an S * S matrix with the rows and columns numbered f
阅读全文
摘要:MatrixTime Limit:3000MSMemory Limit:65536KTotal Submissions:10544Accepted:3945DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 <= i, j <= N).We can change the matrix in the following w
阅读全文
摘要:Rare OrderTime Limit:3000MSMemory Limit:Unknown64bit IO Format:%lld & %llu[Submit] [Go Back] [Status]DescriptionRare OrderA rare book collector recently discovered a book written in an unfamiliar language that used the same characters as the English language. The book contained a short index, bu
阅读全文
摘要:The Broken PedometerThe ProblemA marathon runner uses a pedometer with which he is having problems. In the pedometer the symbols are represented by seven segments (or LEDs):But the pedometer does not work properly (possibly the sweat affected the batteries) and only some of the LEDs are active. The
阅读全文
摘要:病毒侵袭持续中Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1663Accepted Submission(s): 611Problem Description小t非常感谢大家帮忙解决了他的上一个问题。然而病毒侵袭持续中。在小t的不懈努力下,他发现了网路中的“万恶之源”。这是一个庞大的病毒网站,他有着好多好多的病毒,但是这个网站包含的病毒很奇怪,这些病毒的特征码很短,而且只包含“英文大写字符”。当然小t好想好想为民除害,但是小t从来不打没有准
阅读全文
摘要:Immediate DecodabilityAn encoding of a set of symbols is said to be immediatelydecodable if no code for one symbol is the prefix of a code for another symbol. We will assume for this problem that all codes are in binary, that no two codes within a set of codes are the same, that each code has at le.
阅读全文
摘要:该题题意是求给定的字符串集用一个打字机来打出所有的字符串(最后一个),顺序可以打乱,每次操作可以向打字机的末尾添加一个字符删除一个字符以及打印一个单词。这里有一个很强大的想法,那就是先假设每个单词都打印出来起消耗为 sumlenth * 2 + N,在统计所有的相同的字符数 M, 然后得到最长的一个单词的长度L,把这个单词的放在最后打印,最后答案就是 sumlen * 2 + N - M. 代码如下: 1 #include <cstdlib> 2 #include <cstdio> 3 #include <cstring> 4 using namespace
阅读全文
摘要:Problem B: Ultra-QuickSortIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending order. For the input sequence9 1 0 5 4,Ultra-QuickSort produce
阅读全文
摘要:病毒侵袭Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2438Accepted Submission(s): 627Problem Description当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻。。。。在这样的时刻,人们却异常兴奋——我们能在有生之年看到500年一遇的世界奇观,那是多么幸福的事儿啊~~但网路上总有那么些网站,开始借着民众的好奇心,打着介绍日食的旗号,大肆传播病毒。小t不幸成为受害者之一。小t如此生气,他
阅读全文
摘要:Keywords SearchTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10744Accepted Submission(s): 3722Problem DescriptionIn the modern time, Search engine came into the life of everybody like Google, Baidu, etc.Wiskey also wants to bring this feature to
阅读全文
摘要:Number SequenceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 43278Accepted Submission(s): 9449Problem DescriptionA number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to
阅读全文
摘要:该题就是判定一个所给定串集中是否有某些串是另外一些串的前缀串的问题。字典树的话很好办只要判定在构建一个串的路径中是否已经有的节点被标记(此处有串结尾)和如果一个串在该处结尾,那么是否它的的孩子都为空。 这里写了一个暴力版,即现将所给定的所有数字用long long型存储起来,再按从小到大的顺序进行排序,之后再判定一个字符串以及它的依次去掉末位的子串是否已经存在,如果存在则输出NO,否则输出YES。在这里有一个如果不做一些处理的话是会WA的,那就是在每个数组之前加上一个1,这样使的串中的前导零有意义。 代码如下: 1 #include <cstring> 2 #include <
阅读全文
摘要:Exchange RatesTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 157Accepted Submission(s): 89Problem DescriptionNow that the Loonie is hovering about par with the Greenback, you have decided to use your $1000 entrance scholarship to engage in currenc
阅读全文