自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(581)
  • 收藏
  • 关注

原创 LeetCode OJ House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house

2015-03-31 18:21:56 578

原创 LeetCode OJ Binary Tree Maximum Path Sum

Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 / \ 2 3Return 6.i

2015-03-31 17:40:07 598

原创 LeetCode OJ Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.之前在Sicily做过,就是实现一个AVL树了。struct TreeNodeNew { int val; TreeNodeNew *left; Tr

2015-03-31 16:55:43 570

原创 next_permutation & prev_permutation

#include #include #include using namespace std;//next_permutation()全排列的下一个//prev_permutation()全排列的前一个,括号中都为数组的起始结束位置的指针void print_int(int a[], int length) {//这个用来输出数组 for (int i = 0; i < l

2015-03-31 00:31:44 628

原创 Sicily 1028. Hanoi Tower Sequence

1028. Hanoi Tower SequenceConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionHanoi Tower is a famous game invented by the French mathematician Edourard Lucas in 1883. W

2015-03-31 00:29:39 959

原创 Sicily 1779. Fibonacci Sequence Multiplication

1779. Fibonacci Sequence MultiplicationConstraintsTime Limit: 1 secs, Memory Limit: 63.9990234375 MBDescriptionMaybe all of you are familiar with Fibonacci sequence. Now you are

2015-03-31 00:26:34 973

原创 Sicily 1001. Alphacode

1001. AlphacodeConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionAlice and Bob need to send secret messages to each other and are discussing ways to encode their messages: Alice: "Let's jus

2015-03-31 00:25:54 658

原创 Sicily 1003. Hit or Miss

1003. Hit or MissConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionOne very simple type of solitaire game known as "Hit or Miss" (also known as "Frustration," "Harvest

2015-03-31 00:24:44 641

原创 Sicily 1024. Magic Island

1024. Magic IslandConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionThere are N cities and N-1 roads in Magic-Island. You can go from one city to any other. One road only

2015-03-31 00:24:02 874

原创 Sicily 1162. Sudoku

1162. SudokuConstraintsTime Limit: 1 secs, Memory Limit: 32 MB , Special JudgeDescriptionSudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 sm

2015-03-31 00:23:42 712

原创 Sicily 1317. Sudoku

1317. SudokuConstraintsTime Limit: 10 secs, Memory Limit: 32 MBDescriptionSudoku is a placement puzzle. The goal is to enter a symbol in each cell of a grid, most frequently a 9 

2015-03-31 00:22:18 1082

原创 Sicily 1050. Numbers & Letters

1050. Numbers & LettersConstraintsTime Limit: 3 secs, Memory Limit: 32 MBDescriptionIn the early 80’s, a popular TV show on Dutch television was ‘Cijfers en Letters’ (Numbers and Let

2015-03-31 00:21:36 762

原创 Sicily 1063. Who's the Boss

1063. Who's the BossConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionSeveral surveys indicate that the taller you are, the higher you can climb the corporate ladder. At T

2015-03-31 00:20:48 896

原创 Sicily 13907. Dice Game

13907. Dice GameConstraintsTime Limit: 1 secs, Memory Limit: 256 MBDescriptionGunnar and Emma play a lot of board games at home, so they own many dice that are not normal 6- side

2015-03-30 22:15:45 659

原创 Sicily 9562. SUME

9562. SUMEConstraintsTime Limit: 1 secs, Memory Limit: 256 MBDescriptionOnce upon a time, there existed a sequence A consisting of N positive integers. You don't know the sequenc

2015-03-30 01:19:57 651

原创 Sicily 9017. Amazing Mazes

9017. Amazing MazesConstraintsTime Limit: 1 secs, Memory Limit: 256 MBDescriptionYou are requested to solve maze problems. Without passing through these mazes, you

2015-03-30 01:17:32 697

原创 Sicily 7151. 1758!

7151. 1758!ConstraintsTime Limit: 1 secs, Memory Limit: 256 MBDescription1758 is coming! Some boys want to find their dancing partners. For convenience, you may assume the squa

2015-03-30 01:16:52 1119

原创 Sicily 9016. Pablo Squarson's Headache

9016. Pablo Squarson's HeadacheConstraintsTime Limit: 1 secs, Memory Limit: 256 MBDescriptionPablo Squarson is a well-known cubism artist. This year's theme for Pab

2015-03-30 01:16:15 735

原创 Sicily 7143. Treasure

7143. TreasureConstraintsTime Limit: 1 secs, Memory Limit: 256 MBDescriptionOne day, MXWai found a treasure map. The map was divided into 2^n * 2^n grids. The top left corner w

2015-03-30 01:15:17 707

原创 Sicily 4313. Boys and Girls

4313. Boys and GirlsConstraintsTime Limit: 1 secs, Memory Limit: 256 MBDescriptionThere are N boys and N girls at a dance party. We have measured their heights. Each boy will

2015-03-30 01:14:40 733

原创 Sicily 2501. 算算式

2501. 算算式ConstraintsTime Limit: 1 secs, Memory Limit: 256 MBDescription_gXX遇到一个麻烦的式子:S = n1 + n2 + n3 + ...... + nk,已知n、k,求S的值。因为_gXX数学很差,希望你能告诉他答案。但是由于他的数学实在太差了,所以你只需要告诉

2015-03-30 01:11:31 682

原创 Sicily 2368. Penney Game

2368. Penney GameConstraintsTime Limit: 1 secs, Memory Limit: 256 MBDescriptionPenney's game is a simple game typically played by two players. One version of the game calls f

2015-03-30 01:11:26 799

原创 Sicily 2014. Dairy Queen

2014. Dairy QueenConstraintsTime Limit: 1 secs, Memory Limit: 256 MBDescriptionBessie, always in need of an income, has decided to leverage her dairy skills by taking a part-time

2015-03-30 01:10:35 997

原创 Sicily 2012. King

2012. KingConstraintsTime Limit: 1 secs, Memory Limit: 256 MB , Special JudgeDescription There are n children in a country marked by integers from 1 to n.They often fight wit

2015-03-30 01:08:43 547

原创 Sicily 1137. 河床

1137. 河床ConstraintsTime Limit: 10 secs, Memory Limit: 32 MBDescription地理学家们经常要对一段河流进行测量分析。他们从上游开始向下游方向等距离地选择了n(≤30000)个点测量水位深度。得到一组数据d1,d2,……,dn,回到实验室后数据分析员根据需要对数据进行分析,发掘隐藏在数据背后的规律。最

2015-03-30 01:07:32 593

原创 Sicily 1818. 成绩转换

1818. 成绩转换ConstraintsTime Limit: 5 secs, Memory Limit: 32 MBDescription保存学生姓名和成绩,然后通过姓名查询该学生的成绩等级。输入为百分制的成绩,将其转换成对应的等级,具体转换规则如下:90~100 为 A;80~89 为 B;70~79 为 C;60~69

2015-03-30 01:07:17 606

原创 Sicily 10392. Meet and Greet

10392. Meet and GreetConstraintsTime Limit: 1 secs, Memory Limit: 256 MBDescriptionAs is commonly known, cows are very socially polite creatures: any time two cows meet after bei

2015-03-30 01:06:25 867

原创 Sicily 2011. Nine Digits

2011. Nine DigitsConstraintsTime Limit: 2 secs, Memory Limit: 256 MBDescription Nine tiles, each with a number from 1 to 9 on it, are packed into a 3 by 3 frame. Your task is to

2015-03-30 01:04:54 635

原创 Sicily 2002. Feeding Time

2002. Feeding TimeConstraintsTime Limit: 1 secs, Memory Limit: 292.96875 MBDescriptionIt's Bessie's feeding time, and Farmer John is trying to decide where to put her. FJ has a f

2015-03-30 01:03:54 637

原创 Sicily 1938. Message Flood

1938. Message FloodConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescription Well, how do you feel about mobile phone? Your answer would probably be something like that “It’s

2015-03-30 01:03:49 635

原创 Sicily 1934. 移动小球

1934. 移动小球ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescription你有一些小球,从左到右依次编号为1,2,3,...,n. 你可以执行两种指令(1或者2)。其中, 1 X Y表示把小球X移动到小球Y的左边, 2 X Y表示把小球X移动到小球Y右边。 指令保证合法,即X不等于Y。

2015-03-30 01:03:11 672

原创 Sicily 1893. Sell Ticket

1893. Sell TicketConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionOne day, little pig wants to go to the park for fun. He has just one piece of five dollar and luckil

2015-03-30 01:01:48 597

原创 Sicily 1299. Academy Awards

1299. Academy AwardsConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionSelected from 3,850 teams from 1,329 universities in 68 countries competing at 106 sites and prel

2015-03-30 01:01:07 716

转载 Sicily 1888. Circular Sequence

1888. Circular SequenceConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionGiven a sequence with n elements, if the last element is also adjacent to the first element of

2015-03-30 00:59:18 540

原创 Sicily 1936. Knight Moves

1936. Knight MovesConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionA friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the s

2015-03-30 00:58:48 646

原创 Sicily 1781. Knight

1781. KnightConstraintsTime Limit: 1 secs, Memory Limit: 64 MBDescriptionYour task is to write a program to calculate the minimum number of moves needed for a knight to reach one

2015-03-30 00:58:06 598

原创 Sicily 1764. 立体图

1764. 立体图ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescription小渊是个聪明的孩子,他经常会给周围的小朋友们讲些自己认为有趣的内容。最近,他准备给小朋友们讲解立体图,请你帮他画出立体图。小渊有一块面积为m*n的矩形区域,上面有m*n个边长为1的格子,每个格子上堆了一些同样

2015-03-30 00:56:34 477

原创 Sicily 1763. 传球游戏

1763. 传球游戏ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescription上体育课的时候,小蛮的老师经常带着同学们一起做游戏。这次,老师带着同学们一起做传球游戏。 游戏规则是这样的:n个同学站成一个圆圈,其中的一个同学手里拿着一个球,当老师吹哨子时开始传球,每

2015-03-30 00:55:08 632

原创 Sicily 10330. Cutting Sausages

10330. Cutting SausagesConstraintsTime Limit: 1 secs, Memory Limit: 256 MBDescriptionMirko has given up on the difficult coach job and switched to food tasting instead. Having sk

2015-03-30 00:53:34 551

原创 Sicily 1422. Table Tennis

1422. Table TennisConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionThere is a rectangular pool table ABCD with side lengths m and n, where m and n are integers with m

2015-03-30 00:52:00 511

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除