码迷,mamicode.com
首页 >  
搜索关键字:递归 素数    ( 24700个结果
Android屏幕大小适配问题解决
?一、一些基本概念1、长度(真实长度):英寸、inch2、分辨率:density 每英寸像素数 dpi(密度)3、像素:px4、dip的公式:px /dip=dpi/160 所以 dip 类似于英寸、长度(dp=dip,sp类似于dip) dip=160*inchdip= 160/dpi * px当...
分类:移动开发   时间:2014-06-09 22:27:31    阅读次数:460
Symmetric Tree
题目 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / 2 2 / \ / 3 4 4 3 ...
分类:其他好文   时间:2014-06-08 18:12:04    阅读次数:248
快速排序代码(选择最右值最为枢纽元)
下面是参考《数据结构域算法分析》书上部分代码,结合自己理解写出的快速排序代码...
分类:其他好文   时间:2014-06-08 17:29:48    阅读次数:190
Binary Tree Inorder Traversal
1. 递归解法 /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ cl...
分类:其他好文   时间:2014-06-08 16:51:59    阅读次数:199
Light OJ 1278 Sum of Consecutive Integers N拆分成连续整数和
题目来源:Light OJ 1278 Sum of Consecutive Integers 题意:N拆分成连续整数和的方案数 思路:奇因数的个数 #include #include #include #include using namespace std; //筛素数 const int maxn = 10000010; bool vis[maxn]; int prime[10...
分类:其他好文   时间:2014-06-08 15:34:09    阅读次数:295
Binary Tree Preorder Traversal
1. 递归解法 2. 非递归解法(空间复杂度O(n)和O(1))...
分类:其他好文   时间:2014-06-08 10:47:37    阅读次数:139
Subsets II
题目 Given a collection of integers that might contain duplicates, S, return all possible subsets. Note: Elements in a subset must be in non-descending order.The solution set must not c...
分类:其他好文   时间:2014-06-08 05:32:21    阅读次数:196
Light OJ 1026 Critical Links 求桥
题目来源:Light OJ 1026 Critical Links 题意:输出桥 思路:模版 #include #include #include #include #include using namespace std; const int maxn = 10010; struct Edge { int u, v; Edge(){} Edge(int u, int v):...
分类:其他好文   时间:2014-06-08 04:07:05    阅读次数:235
Subsets
题目 Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets. ...
分类:其他好文   时间:2014-06-08 04:01:05    阅读次数:240
循环-04. 验证“哥德巴赫猜想”(20)
数学领域著名的“哥德巴赫猜想”的大致意思是:任何一个大于2的偶数总能表示为两个素数之和。比如:24=5+19,其中5和19都是素数。本实验的任务是设计一个程序,验证20亿以内的偶数都可以分解成两个素数之和。 输入格式: 输入在一行中给出一个(2, 2 000 000 000]范围内的偶数N。 输出格式: 在一行中按照格式“N = p + q”输出N的素数分解,其中p ...
分类:其他好文   时间:2014-06-08 03:53:01    阅读次数:647
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!