/*【程序9】
题目:一个数如果恰好等于它的因子之和,这个数就称为"完数"。例如6=1+2+3.编程找出1000以内的所有完数。*/
packagetest;
importjava.util.ArrayList;
importjava.util.List;
publicclasstest{
publicstaticbooleanovernum(intnumber){
List<Integer>list=..
分类:
编程语言 时间:
2014-05-27 03:34:38
阅读次数:
245
/*【程序7】
题目:输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。
1.程序分析:利用while语句,条件为输入的字符不为‘\n‘.*/
packagetest;
importjava.util.ArrayList;
importjava.util.List;
publicclasstest{
publicstaticList<Integer>countstr..
分类:
编程语言 时间:
2014-05-27 03:32:01
阅读次数:
375
Digital Roots
时间限制: 1 Sec 内存限制: 128 MB
提交: 91 解决: 29
[提交][状态][论坛]
题目描述
The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single d...
分类:
其他好文 时间:
2014-05-22 13:01:21
阅读次数:
223
题目:Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
罗马表示方式如下:
I = 1;
V = 5;
X = 10;
L = 50;
C = 100;
D = 500;
M = 1000;
其中每...
分类:
其他好文 时间:
2014-05-22 13:00:09
阅读次数:
240
The number of 1 bits in an integer.
分类:
其他好文 时间:
2014-05-22 01:21:04
阅读次数:
214
Evaluate the value of an arithmetic expression
inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an
integer or another express...
分类:
其他好文 时间:
2014-05-22 00:49:57
阅读次数:
311
【题目】
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 should run in O(n) time and uses constant space.
【题意】
给定一个数组,找出第一个缺失的正数。时间复杂度O(n)
...
分类:
其他好文 时间:
2014-05-21 17:13:07
阅读次数:
219
【题目】
The count-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, ...
1 is read off as "one 1" or 11.
11 is read off as "two 1s" or 21.
21 is read off as "one 2, then one 1" or 1211.
Given an integer n, generate...
分类:
其他好文 时间:
2014-05-21 15:20:07
阅读次数:
213
Description
In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn ? 1 + Fn ? 2 for n ≥ 2. For example, the first ten terms of
the Fibonacci sequence are:
0, 1, 1, 2, 3, 5, 8, 13, 21, ...
分类:
其他好文 时间:
2014-05-21 09:39:15
阅读次数:
231