
ACM
杜庆彦
莫等闲
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
leetcode Linked List Cycle II
problem: Given a linked list, return the node where the cycle begins. If there is no cycle, return NULL.Follow up:Can you solve it without using extra space?方法:求链表中是否有环的扩展。用快慢指针法原创 2014-03-04 21:08:41 · 423 阅读 · 0 评论 -
生成1~n的排列
摘自《算法竞赛入门经典》按字典序生成1~n的全排列。伪代码:void print_permutation(序列A, 集合S){ if(S为空) 输出序列A; else 按从小到大的顺序依次考虑S的每个元素v { print_permutation(在A的末尾添加v后得到的新序列, S转载 2014-02-28 14:03:01 · 554 阅读 · 0 评论 -
hdoj Largest prime factor
Problem DescriptionEverybody knows any number can be combined by the prime number.Now, your task is telling me what position of the largest prime factor.The position of prime 2 is 1, prime 3 i原创 2014-03-02 13:50:37 · 545 阅读 · 0 评论 -
uva 10718 - Bit Mask
Problem ABit MaskTime Limit1 SecondIn bit-wise expression, mask is a common term. You can get a certain bit-pattern using mask. For example, if you want to make first原创 2014-03-02 08:52:55 · 567 阅读 · 0 评论 -
HDU Eddy's digital Roots
Eddy's digital RootsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3947 Accepted Submission(s): 2207Problem DescriptionThe d原创 2014-02-17 20:49:31 · 510 阅读 · 0 评论 -
uva 10716 - Evil Straw Warts Live
Problem D: Evil Straw Warts LiveA palindrome is a string of symbols that is equal to itself when reversed. Given an input string, not necessarily a palindrome, compute the number of swaps necessary原创 2014-02-28 20:08:46 · 520 阅读 · 0 评论 -
uva 729 - The Hamming Distance Problem
The Hamming Distance Problem The Hamming distance between two strings of bits (binary integers) is the number of corresponding bit positions that differ. This can be found by using XOR on原创 2014-03-01 09:30:08 · 496 阅读 · 0 评论 -
uva 993 - Product of digits
Product of digits For a given non-negative integer number N , find the minimal natural Q such that the product of all digits of Q is equal N .Input The first line of input contains原创 2014-02-27 20:26:40 · 542 阅读 · 0 评论 -
uva 10020 - Minimal coverage
Minimal coverage The ProblemGiven several segments of line (int the X axis) with coordinates [Li,Ri]. You are to choose the minimal amount of them, such they would completely cover the原创 2014-02-25 20:28:18 · 507 阅读 · 0 评论 -
uva 311 Packets
Packets A factory produces products packed in square packets of the same height h and of the sizes , , , , , . These products are always delivered to customers in the square parcel原创 2014-02-24 21:42:58 · 501 阅读 · 0 评论 -
uva 10026 - Shoemaker's Problem
Shoemaker's Problem Shoemaker has N jobs (orders from customers) which he must make. Shoemaker can work on only one job in each day. For each ith job, it is known the integer Ti (1i<=1000)原创 2014-02-24 19:43:29 · 566 阅读 · 0 评论 -
uva 11218 - KTV
Problem KKTVOne song is extremely popular recently, so you and your friends decided to sing it in KTV. The song has 3 characters, so exactly 3 people should sing together each time (yes, there a原创 2014-02-23 20:17:57 · 617 阅读 · 0 评论 -
uva 572 - Oil Deposits
Oil Deposits The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creat原创 2014-02-23 15:28:22 · 474 阅读 · 0 评论 -
uva 107 - The Cat in the Hat
The Cat in the Hat Background(An homage to Theodore Seuss Geisel)The Cat in the Hat is a nasty creature,But the striped hat he is wearing has a rather nifty feature.With one flic原创 2014-02-22 20:13:35 · 544 阅读 · 0 评论 -
uva 10025 - The ? 1 ? 2 ? ... ? n = k problem
The ? 1 ? 2 ? ... ? n = k problem The problemGiven the following formula, one can set operators '+' or '-' instead of each '?', in order to obtain a given k? 1 ? 2 ? ... ? n = kFor原创 2014-02-21 09:23:43 · 486 阅读 · 0 评论 -
11111 - Generalized Matrioshkas
Problem B - Generalized Matrioshkas Vladimir worked for years making matrioshkas, those nesting dolls that certainly represent truly Russian craft. A matrioshka is a doll that may be opene原创 2014-01-15 20:38:40 · 476 阅读 · 0 评论 -
673 - Parentheses Balance
Parentheses Balance You are given a string consisting of parentheses () and []. A string of this type is said to be correct:(a)if it is the empty string(b)if A and B are correct, AB is c原创 2014-01-15 19:17:23 · 435 阅读 · 0 评论 -
uva 568 Just the Facts
Just the Facts The expression N!, read as ``N factorial," denotes the product of the first N positive integers, where N is nonnegative. So, for example,NN!01原创 2014-01-15 16:08:32 · 476 阅读 · 0 评论 -
POJ 1008
Maya CalendarTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 62243 Accepted: 19200DescriptionDuring his last sabbatical, professor M. A. Ya made a surpr原创 2014-01-15 16:06:52 · 472 阅读 · 0 评论