ArrestTime Limit: 1000msMemory Limit: 32768KBThis problem will be judged onHDU. Original ID:441164-bit integer IO format:%I64d Java class name:MainThe...
分类:
其他好文 时间:
2014-12-05 16:48:25
阅读次数:
229
char c = '4';// 方法一:(最佳)int i1 = Character.getNumericValue(c);// 方法二:int i2 = Integer.parseInt(Character.toString(c));// 方法三:(不推荐)int i3 = (int)c - 48...
分类:
编程语言 时间:
2014-12-05 16:47:56
阅读次数:
194
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Here, we will use the integer...
分类:
其他好文 时间:
2014-12-05 12:46:33
阅读次数:
147
不废话,先上代码:ArrayList col = new ArrayList(); System.out.println("Initial size: " + col.size()); for(int i = 0; i 里的类型是Integer,我传入一个int的应该可以自动实现autoboxi.....
分类:
其他好文 时间:
2014-12-05 12:10:44
阅读次数:
142
现状1+1=?,不加思索2。有一个数字要存储在程序里,不加思索int。那为什么java要弄一个Integer类型出来?有什么用?怎么用?差别在哪儿?度娘说java提供了两种数据类型,一种是值类型,一种是引用类型。int是值类型,Integer是引用类型。那什么是值类型,神马是引用类型我知道的:计算机...
分类:
其他好文 时间:
2014-12-05 00:40:59
阅读次数:
217
问题描述:
Determine whether an integer is a palindrome. Do this without extra space.
基本思路:
考虑到回文的特点,根据给定数字获得与给定数字低位高位反序的数字。如果是回文数,则两数想等;否则不等。(即使反序数字溢出,也可的到正确结果)
代码:
bool isPalindrome(int x) { //...
分类:
其他好文 时间:
2014-12-04 20:04:19
阅读次数:
159
问题描述:
Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
基本思路:
熟悉罗马数字和阿拉伯数字的转换规则,并找出规律。写出程序。 此题重点在提出规律。
阿拉伯数字到罗马数字的映射可以参考http://baike....
分类:
其他好文 时间:
2014-12-04 19:59:40
阅读次数:
214
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[ 7...
分类:
其他好文 时间:
2014-12-04 14:00:17
阅读次数:
174
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of...
分类:
其他好文 时间:
2014-12-04 08:47:00
阅读次数:
168
Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ...
分类:
其他好文 时间:
2014-12-03 23:09:05
阅读次数:
281