摘要: Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.找一个二维图上在一条直线上点的最大数,不知道有啥更好的方法。需要注意重复点的情况 1 class Solu... 阅读全文
posted @ 2014-10-22 16:09 Madao_ 阅读(152) 评论(0) 推荐(0)
摘要: Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another express... 阅读全文
posted @ 2014-10-22 14:35 Madao_ 阅读(120) 评论(0) 推荐(0)
摘要: Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the".click to show clarification.C... 阅读全文
posted @ 2014-10-22 12:50 Madao_ 阅读(130) 评论(0) 推荐(0)
摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the... 阅读全文
posted @ 2014-10-22 11:21 Madao_ 阅读(145) 评论(0) 推荐(0)
摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element.You m... 阅读全文
posted @ 2014-10-16 21:45 Madao_ 阅读(100) 评论(0) 推荐(0)
摘要: 1002. A+B for Polynomials (25)时间限制 400 ms内存限制 32000 kB代码长度限制 16000 B判题程序 Standard 作者 CHEN, YueThis time, you are supposed to find A+B where A and B ar... 阅读全文
posted @ 2014-07-29 00:50 Madao_ 阅读(142) 评论(0) 推荐(0)
摘要: Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less t... 阅读全文
posted @ 2014-04-29 20:06 Madao_ 阅读(113) 评论(0) 推荐(0)
摘要: 给定一个常数K以及一个单链表L,请编写程序将L中每K个结点反转。例如:给定L为1→2→3→4→5→6,K为3,则输出应该为3→2→1→6→5→4;如果K为4,则输出应该为4→3→2→1→5→6,即最后不到K个元素不反转。输入格式: 每个输入包含1个测试用例。每个测试用例第1行给出第1个结点的地址、结... 阅读全文
posted @ 2014-03-24 00:30 Madao_ 阅读(169) 评论(0) 推荐(0)
摘要: 科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式[+-][1-9]"."[0-9]+E[+-][0-9]+,即数字的整数部分只有1位,小数部分至少有1位,该数字及其指数部分的正负号即使对正数也必定明确给出。现以科学计数法的格式给出实数A,请编写程序按普通数字表示法输出A,... 阅读全文
posted @ 2014-03-23 23:39 Madao_ 阅读(237) 评论(0) 推荐(0)
摘要: 给定数字0-9各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意0不能做首位)。例如:给定两个0,两个1,三个5,一个8,我们得到的最小的数就是10015558。现给定数字,请编写程序输出能够组成的最小的数。输入格式: 每个输入包含1个测试用例。每个测试用例... 阅读全文
posted @ 2014-03-23 22:57 Madao_ 阅读(108) 评论(0) 推荐(0)