码迷,mamicode.com
首页 >  
搜索关键字:integer game    ( 20395个结果
Leetcode | First Missing Positive
Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm sho...
分类:其他好文   时间:2014-05-16 02:58:54    阅读次数:249
[leetcode]_String to Integer (atoi)
非常考虑思维全面性的一道题,考验是否能够考虑本问题的方方面面。题目:将一个string转换为int。实现函数atoi()的功能。先应该明确atoi()有哪些特殊功能:(正常的正负数情况我就不列了)inputoutput”+1“1” + 1“0(error了)” 1“1(前头只有空格是合法的...
分类:其他好文   时间:2014-05-16 01:08:33    阅读次数:245
[leetcode]_Palindrome Number
判断integer是否为回文串(负数全部不为回文串)思路很直接,提取出integer中的每一位,一头一尾进行比较是否相同。一次AC , 直接上代码:public boolean isPalindrome(int x) { if(x = 0 && x 0){ ...
分类:其他好文   时间:2014-05-16 00:24:44    阅读次数:386
【LeetCode】- String to Integer (字符串转成整形)
[ 问题: ] Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases. Notes: It is intended for this...
分类:其他好文   时间:2014-05-15 23:34:05    阅读次数:353
hdu 2188 巴什博弈
巴什博奕(Bash Game):只有一堆n个物品,两个人轮流从这堆物品中取物,规 定每次至少取一个,最多取m个。最后取光者得胜。     显然,如果n=m+1,那么由于一次最多只能取m个,所以,无论先取者拿走多少个, 后取者都能够一次拿走剩余的物品,后者取胜。因此我们发现了如何取胜的法则:如果 n=(m+1)r+s,(r为任意自然数,s≤m),那么先取者要拿走s个物品,如果后取者拿走 k...
分类:其他好文   时间:2014-05-15 22:50:18    阅读次数:389
[sg简单应用] poj 1082 Calendar Game
题目链接: http://poj.org/problem?id=1082 Calendar Game Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4742   Accepted: 2236 Description Adam and...
分类:其他好文   时间:2014-05-15 20:33:25    阅读次数:223
leetcode Integer to Roman
把阿拉伯数字转换成罗马数字...
分类:其他好文   时间:2014-05-15 19:22:51    阅读次数:232
[leetcode]_Reverse Integer
经历了三道树的题后,完全崩溃中,急需一道非树图的题来挽救信心。题目:反转数字。input : 123 , output : 321.思路:直接,没什么好说的。自己代码:很龊,有大量的冗余信息,还申请了一个List,虽然AC了,但有很大改进空间。public int reverse(int x) { ...
分类:其他好文   时间:2014-05-15 14:22:31    阅读次数:212
java并发编程之Guarded Suspention
当客户端请求速度远远大于服务端的处理速度,这时候就非常适合使用GuardedSuspention模式packagecn.fcl.guardendSuspension; importjava.util.ArrayList; importjava.util.List; publicclassRequestQueue{ privateList<Integer>integers=newArrayList<Integer>(); ..
分类:编程语言   时间:2014-05-15 09:08:21    阅读次数:283
UVA之1121 - Subsequence
【题目】 A sequence of N positive integers (10 N , each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the subse...
分类:其他好文   时间:2014-05-15 07:58:17    阅读次数:329
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!