Given a collection of numbers that might contain duplicates, return all possible unique permutations.
For example,
[1,1,2] have the following unique permutations:
[1,1,2], [1,2,1],
and [2,1,1]....
分类:
其他好文 时间:
2014-09-23 17:07:24
阅读次数:
222
题目大意:费马定理:a^p = a(mod p) (a为大于1的整数,p为素数),一些非素数p,同样也符合上边的
定理,这样的p被称作基于a的伪素数,给你p和a,判断p是否是基于a的伪素数
思路:很简单的快速幂取余+素性判断
如果p为素数,则直接输出no
如果p不为素数,则进行快速幂取余判断是否为伪素数,若是,输出yes,不是,输出no...
分类:
其他好文 时间:
2014-09-23 08:30:34
阅读次数:
248
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
分类:
其他好文 时间:
2014-09-22 23:28:53
阅读次数:
160
【题目】
Given a binary tree containing digits from 0-9 only, each root-to-leaf
path could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Fin...
分类:
其他好文 时间:
2014-09-22 19:30:53
阅读次数:
175
The kth great number
Xiao Ming and Xiao Bao are playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao what the kth great number is. Because the numb...
分类:
其他好文 时间:
2014-09-22 19:12:13
阅读次数:
197
PalindromeTime Limit:3000MSMemory Limit:65536KTotal Submissions:51631Accepted:17768DescriptionA palindrome is a symmetrical string, that is, a string ...
分类:
其他好文 时间:
2014-09-22 17:15:22
阅读次数:
267
Where is the Marble?
Where is the Marble?
Raju and Meena love to play with Marbles. They have got a lot of marbles with numbers written on them. At the beginning, Raju wou...
分类:
其他好文 时间:
2014-09-22 01:04:21
阅读次数:
477
题目:找到用2,3,5,7为数的因第n个数字。
分析:dp,数据结构。类似于合并果子的队列维护,用4根指针分别指向队列,用当前的数乘以对应数字即可。
说明:(2011-09-19 01:42)
#include
using namespace std;
int F[ 5845 ];
int n[ 4 ] = {2,3,5,7};
int p[ 4 ];
int main()
{
...
分类:
其他好文 时间:
2014-09-21 23:57:21
阅读次数:
345
打表大军是一股邪恶势力→_→ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 us...
分类:
其他好文 时间:
2014-09-21 19:25:51
阅读次数:
781
其中,将洞穴连起来的算法要好好体会。学习构建临时变量列表,确认循环用FOR,非确定循环用 WHILE,并定好退出条件。from random import choicecave_numbers = range(0,20)caves = []for i in cave_numbers: cave...
分类:
其他好文 时间:
2014-09-21 00:04:59
阅读次数:
431