完美平方
摘要:给一个正整数 n, 找到若干个完全平方数(比如1, 4, 9, ... )使得他们的和等于 n。你需要让平方数的个数最少。 给出 n = 12, 返回 3 因为 12 = 4 + 4 + 4。给出 n = 13, 返回 2 因为 13 = 4 + 9。 dp. 上面dp的时间复杂度是 O(n^2)空
阅读全文
posted @
2016-08-31 19:56
Beserious
阅读(1198)
推荐(0) 编辑
给出树的前序遍历和后序遍历,构建树
摘要:必须知道一点: 前序遍历是:根、左、右 中序遍历是:左、根、右 后序遍历是:左、右、根 递归构建即可。
阅读全文
posted @
2016-08-29 11:29
Beserious
阅读(629)
推荐(0) 编辑
给定序列,求这个序列的出栈次序
摘要:比如1,2,3 的出栈次序可以是{1,2,3}{2,1,3}{2,3,1}{1,3,2}{3,2,1}5种。 其实这个 和leetcode生成括号那个题目很像。题目链接https://leetcode.com/problems/generate-parentheses/ 题解 http://www.
阅读全文
posted @
2016-08-20 15:00
Beserious
阅读(634)
推荐(0) 编辑
HDU 5862Counting Intersections
摘要:Counting Intersections Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 51 Accepted Submission(s)
阅读全文
posted @
2016-08-18 18:21
Beserious
阅读(427)
推荐(0) 编辑
HDU 5858Hard problem
摘要:Hard problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 38 Accepted Submission(s): 23 Proble
阅读全文
posted @
2016-08-18 17:50
Beserious
阅读(273)
推荐(0) 编辑
Codeforces Round #311 (Div. 2) D - Vitaly and Cycle
摘要:D. Vitaly and Cycle time limit per test 1 second time limit per test memory limit per test 256 megabytes memory limit per test input standard input in
阅读全文
posted @
2016-08-17 23:29
Beserious
阅读(159)
推荐(0) 编辑
HDU 5855Less Time, More profit
摘要:Less Time, More profit Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 468 Accepted Submission(s)
阅读全文
posted @
2016-08-17 17:09
Beserious
阅读(233)
推荐(0) 编辑
2015-2016 ACM-ICPC Pacific Northwest Regional Contest (Div. 2)V - Gears
摘要:Problem V | limit 4 secondsGearsA set of gears is installed on the plane. You are given the center coordinate and radius of eachgear. For a given inpu
阅读全文
posted @
2016-08-15 21:12
Beserious
阅读(590)
推荐(0) 编辑
Codeforces Round #311 (Div. 2)C. Arthur and Table
摘要:C. Arthur and Table time limit per test 1 second time limit per test memory limit per test 256 megabytes memory limit per test input standard input in
阅读全文
posted @
2016-08-15 10:49
Beserious
阅读(286)
推荐(0) 编辑
HDU 5833 Zhu and 772002
摘要:Zhu and 772002 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 542 Accepted Submission(s): 180 Pr
阅读全文
posted @
2016-08-14 19:37
Beserious
阅读(569)
推荐(0) 编辑
2015-2016 ACM-ICPC Pacific Northwest Regional Contest (Div. 2) S Surf
摘要:SurfNow that you've come to Florida and taken up surng, you love it! Of course, you've realized thatif you take a particular wave, even if it's very
阅读全文
posted @
2016-08-13 21:25
Beserious
阅读(474)
推荐(0) 编辑
Codeforces Round #367 (Div. 2)C. Hard problem
摘要:C. Hard problem time limit per test 1 second time limit per test memory limit per test 256 megabytes memory limit per test input standard input input
阅读全文
posted @
2016-08-12 14:43
Beserious
阅读(185)
推荐(0) 编辑
Codeforces Round #367 (Div. 2) D. Vasiliy's Multiset
摘要:D. Vasiliy's Multiset time limit per test 4 seconds time limit per test memory limit per test 256 megabytes memory limit per test input standard input
阅读全文
posted @
2016-08-12 13:49
Beserious
阅读(465)
推荐(0) 编辑
HDU 5821 Ball
摘要:Ball Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 376 Accepted Submission(s): 225 Problem Desc
阅读全文
posted @
2016-08-11 23:01
Beserious
阅读(208)
推荐(0) 编辑
Codeforces Round #228 (Div. 2) C. Fox and Box Accumulation
摘要:C. Fox and Box Accumulation time limit per test 1 second time limit per test memory limit per test 256 megabytes memory limit per test input standard
阅读全文
posted @
2016-08-10 23:01
Beserious
阅读(212)
推荐(0) 编辑
HDU 5810 Balls and Boxes
摘要:Balls and Boxes Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 291 Accepted Submission(s): 213 P
阅读全文
posted @
2016-08-10 14:06
Beserious
阅读(163)
推荐(0) 编辑
HDU 5818 Joint Stacks
摘要:Joint Stacks Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 610 Accepted Submission(s): 282 Prob
阅读全文
posted @
2016-08-10 09:51
Beserious
阅读(141)
推荐(0) 编辑
HDU 5813 Elegant Construction
摘要:Elegant Construction Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 204 Accepted Submission(s):
阅读全文
posted @
2016-08-09 21:24
Beserious
阅读(218)
推荐(0) 编辑
Codeforces Round #357 (Div. 2)C. Heap Operations
摘要:C. Heap Operations time limit per test 1 second time limit per test memory limit per test 256 megabytes memory limit per test input standard input inp
阅读全文
posted @
2016-08-09 11:08
Beserious
阅读(140)
推荐(0) 编辑
Codeforces Round #364 (Div. 2) C. They Are Everywhere
摘要:C. They Are Everywhere time limit per test 2 seconds time limit per test memory limit per test 256 megabytes memory limit per test input standard inpu
阅读全文
posted @
2016-08-08 15:37
Beserious
阅读(221)
推荐(0) 编辑
HDU5806 NanoApe Loves Sequence Ⅱ
摘要:NanoApe Loves Sequence Ⅱ Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/131072 K (Java/Others)Total Submission(s): 517 Accepted Submissio
阅读全文
posted @
2016-08-07 11:14
Beserious
阅读(199)
推荐(0) 编辑
HDU 5805 NanoApe Loves Sequence
摘要:NanoApe Loves Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/131072 K (Java/Others)Total Submission(s): 421 Accepted Submission(
阅读全文
posted @
2016-08-07 09:57
Beserious
阅读(367)
推荐(0) 编辑
HDU1052Tian Ji -- The Horse Racing
摘要:Tian Ji -- The Horse Racing Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 26683 Accepted Submis
阅读全文
posted @
2016-08-05 20:51
Beserious
阅读(337)
推荐(0) 编辑
HDU 5794 A Simple Chess
摘要:A Simple Chess Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 614 Accepted Submission(s): 159 Pr
阅读全文
posted @
2016-08-05 10:17
Beserious
阅读(214)
推荐(0) 编辑
HDU 5791 Two
摘要:Two Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 163 Accepted Submission(s): 72 Problem Descri
阅读全文
posted @
2016-08-02 18:57
Beserious
阅读(441)
推荐(0) 编辑
HDU 5783Divide the Sequence
摘要:Divide the Sequence Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 119 Accepted Submission(s): 7
阅读全文
posted @
2016-08-02 18:38
Beserious
阅读(219)
推荐(0) 编辑
HDU2072单词数
摘要:#include #include #include using namespace std; int main() { string s,line; while(getline(cin,line)&&line[0]!='#') { stringstream ss(line); set dict; while(ss>>s...
阅读全文
posted @
2016-08-01 12:15
Beserious
阅读(119)
推荐(0) 编辑