全排列问题。常用的排列生成算法有序数法、字典序法、换位法(Johnson(Johnson-Trotter)、轮转法以及Shift cursor cursor* (Gao & Wang)法。
【题目】
Given a collection of numbers, return all possible permutations.
For example,
[1,2,3] have...
分类:
其他好文 时间:
2014-10-16 23:05:23
阅读次数:
302
Round Numbers
Time Limit: 2000MS Memory Limit: 65536K
Total Submissions: 9149 Accepted: 3248
Description
The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Pa...
分类:
其他好文 时间:
2014-10-16 20:52:43
阅读次数:
198
Hashmat the Brave WarriorXX自己有士兵a人, 敌军有士兵b人,自己的士兵永远比敌军少, 求对方比自己多多少人。 (虽说要从头刷,但是这样的还是太水了吧 2333333喜闻乐见的错了因为2^32爆了int。。。These two numbers in each line...
分类:
其他好文 时间:
2014-10-16 20:04:33
阅读次数:
264
#include #include #include using namespace std;bool double_num(vector &num) { int carry = 0; int i = num.size() - 1; while (i>=0) { in...
分类:
其他好文 时间:
2014-10-16 16:06:22
阅读次数:
176
这一次又只出了一题,第二题没有分析好,竟然直接copy代码,不过长见识了。。
第一题给了一些限制条件,自己没有分析好,就去乱搞,结果各种不对,后来有读题才发现。。暴力乱搞。。
题目:
Beautiful Palindrome Number
Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 32768/32768 K ...
分类:
其他好文 时间:
2014-10-16 00:46:21
阅读次数:
382
# if we list all natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6, and 9. The sum of these multiples is 23. Find the sum of all t...
分类:
编程语言 时间:
2014-10-15 23:39:21
阅读次数:
221
题目:Determine whether an integer is a palindrome. Do this without extra space. 刚开始看到题目的时候想着用栈来处理,每进来一个数与栈顶元素比较相同则栈顶元素处栈,不同则元素入栈,最后栈为空或剩一个数为真,我是以“12343....
分类:
编程语言 时间:
2014-10-15 19:45:31
阅读次数:
249
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
Note: You can only move either down or right at...
分类:
其他好文 时间:
2014-10-15 15:13:00
阅读次数:
200
冒泡排序FunctionbubbleSort($numbers){$cnt=count($numbers);for($i=0;$i<$cnt-1;$i++){//循环比较for($j=$i+1;$j<$cnt;$j++){if($numbers[$j]<$numbers[$i]){//执行交换$temp=$numbers[$i];$numbers[$i]=$numbers[$j];$numbers[$j]=$temp;}}}Return$numbers;}快速排..
分类:
编程语言 时间:
2014-10-15 04:59:00
阅读次数:
196
Problem Description
A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first...
分类:
其他好文 时间:
2014-10-14 23:41:13
阅读次数:
266