摘要: B-numberTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1654 Accepted Submission(s): 902Problem DescriptionA wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub- string "13" and can be divided 阅读全文
posted @ 2013-10-05 15:23 heaventouch 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Good NumbersTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1115 Accepted Submission(s): 414Problem DescriptionIf we sum up every digit of a number and the result can be exactly divided by 10, we say this number is a good number.You are requ... 阅读全文
posted @ 2013-10-05 10:06 heaventouch 阅读(165) 评论(0) 推荐(0) 编辑
摘要: wolf5xTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 320 Accepted Submission(s): 205Special JudgeProblem DescriptionThere are n grids in a row. The coordinates of grids are numbered from x=1 to x=n. Someone starts from x=0. You can step for... 阅读全文
posted @ 2013-10-04 19:00 heaventouch 阅读(91) 评论(0) 推荐(0) 编辑
摘要: ActivationTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 966 Accepted Submission(s): 353Problem DescriptionAfter 4 years' waiting, the game "Chinese Paladin 5" finally comes out. Tomato is a crazy fan, and luckily he got the first 阅读全文
posted @ 2013-10-04 14:43 heaventouch 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Card CollectorTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1881 Accepted Submission(s): 872Special JudgeProblem DescriptionIn your childhood, do you crazy for collecting the beautiful cards in the snacks? They said that, for example, if y... 阅读全文
posted @ 2013-10-04 10:07 heaventouch 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 转自: http://hi.baidu.com/pty123/item/06730a080b8523354bc4a356逆元的几种求法定义 a * x = 1(mod p),求x1、扩展欧几里德:令ax + py = 1Gcd的本质就是进行迭代,不断缩小范围。不详细讲。。参考:http://baike.baidu.com/view/1478219.htm2、根据费马小定理:若(a,p)互质,且p为质数:则 a ^ (p – 1)= 1 (% p)所以x = a ^ (p- 2) (% p)快速幂求之,查询log(n),常数比扩展欧几里德稍大3、O(n)预处理-O(1)询问预处理1-n关于p的逆 阅读全文
posted @ 2013-10-03 20:28 heaventouch 阅读(355) 评论(0) 推荐(0) 编辑
摘要: DiceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 126 Accepted Submission(s): 75Problem DescriptionGiven a normal dice (with 1, 2, 3, 4, 5, 6 on each face), we define: F(N) to be the expected number of tosses until we have a number facing ... 阅读全文
posted @ 2013-10-03 19:51 heaventouch 阅读(171) 评论(0) 推荐(0) 编辑
摘要: Aeroplane chessTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 915 Accepted Submission(s): 631Problem DescriptionHzz loves aeroplane chess very much. The chess map contains N+1 grids labeled from 0 to N. Hzz starts at grid 0. For each step h... 阅读全文
posted @ 2013-10-03 15:59 heaventouch 阅读(134) 评论(0) 推荐(0) 编辑
摘要: HintFor the fourth test case, (A,B) can be (0,5), (0,-5), (5,0), (-5,0), (3,4), (3,-4), (-3,4), (-3,-4), (4,3) , (4,-3), (-4,3), (-4,-3) Source 2011 Multi-University Training Contest 1 - Host by HNU Recommendxubiao 1 //31MS 280K 439 B C++ 2 //简单题..O(lgn) 3 #include 4 #include 5 int Pow(i... 阅读全文
posted @ 2013-10-03 10:39 heaventouch 阅读(144) 评论(0) 推荐(0) 编辑
摘要: StringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1162 Accepted Submission(s): 426Problem DescriptionGiven 3 strings A, B, C, find the longest string D which satisfy the following rules:a) D is the subsequence of Ab) D is the subsequence... 阅读全文
posted @ 2013-10-03 09:30 heaventouch 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Advanced FruitsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1313 Accepted Submission(s): 648Special JudgeProblem DescriptionThe company "21st Century Fruits" has specialized in creating new sorts of fruits by transferring genes from o 阅读全文
posted @ 2013-10-02 14:53 heaventouch 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 吉哥系列故事——完美队形ITime Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1666 Accepted Submission(s): 482Problem Description 吉哥这几天对队形比较感兴趣。 有一天,有n个人按顺序站在他的面前,他们的身高分别是h[1], h[2] ... h[n],吉哥希望从中挑出一些人,让这些人形成一个新的队形,新的队形若满足以下三点要求,则称之为完美队形: 1、挑出的人保持他们在原队... 阅读全文
posted @ 2013-10-02 10:06 heaventouch 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Greatest Common Increasing SubsequenceTime Limit: 2 Seconds Memory Limit: 65536 KB Special Judge You are given two sequences of integer numbers. Write a program to determine their common increasing subsequence of maximal possible length. Sequence S1, S2, ..., SN of length N is called a... 阅读全文
posted @ 2013-10-02 08:59 heaventouch 阅读(136) 评论(0) 推荐(0) 编辑
摘要: PalindromeTime Limit: 15000MS Memory Limit: 65536KTotal Submissions: 2939 Accepted: 1081DescriptionAndy the smart computer science student was attending an algorithms class when the professor asked the students a simple question, "Can you propose an efficient algorithm to find the length of the 阅读全文
posted @ 2013-10-01 16:08 heaventouch 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 最长回文Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6048 Accepted Submission(s): 2073Problem Description给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度.回文就是正反读都是一样的字符串,如aba, abba等 Input输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S两组case之间由空行隔... 阅读全文
posted @ 2013-10-01 15:52 heaventouch 阅读(119) 评论(0) 推荐(0) 编辑