码迷,mamicode.com
首页 >  
搜索关键字:only prime factors    ( 11256个结果
数据结构之最小生成树
最小生成树: 一个连通图的生成树是一个极小连通子图,它含有图中全部顶点,但只有足以构成一棵树的n-1条边。这种构造连通网的最小代价生成树称为最小生成树,详见数据结构之图(术语、存储结构、遍历)。 求连通网的最小生成树有两种经典方法:普里姆(Prime)算法和克鲁斯卡尔(Kruskal)算法。 1、Prime算法 (1)算法描述:假设N=(V,{E})是连通网,TE是N上最小生成树中边的集合。从V中任选一个顶点u0,算法从U={u0}(u0∈V),TE={}开始,重复执行以下步骤: 在所有u∈U、v∈V-U...
分类:其他好文   时间:2014-06-10 15:38:52    阅读次数:211
poj 3026
挺直接的一个题 哎 想复杂了题意:把n*m矩阵中的字母最小生成树求它的边权值之和 只有字母可以分叉 多了一个提取点的过程思路:prime 算法的简单应用#include#include#includeusing namespace std;char map[55][55];int node[55][...
分类:其他好文   时间:2014-06-09 21:29:26    阅读次数:276
ubuntu14.04 64位系统如何运行xampp集成环境
zzs@ubuntu:~$ sudo /opt/lampp/lampp startapache[sudo] password for zzs:XAMPP is currently only availably as 32 bit application. Please use a 32 bit co...
分类:其他好文   时间:2014-06-08 23:04:45    阅读次数:288
LeetCode: Populating Next Right Pointers in Each Node II [117]
【题目】 Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would your previous solution still work? Note: You may only use constant extra space. For example, Given the following binary tre...
分类:其他好文   时间:2014-06-08 15:46:22    阅读次数:303
LeetCode: Pascal's Triangle II [119]
【题目】 Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3,3,1]. Note: Could you optimize your algorithm to use only O(k) extra space? 【题意】 给定行索引k, k从0开始,返回该索引指向的杨辉三角的行 要求只能使用O(k)的额外空间 【思路】 ...
分类:其他好文   时间:2014-06-08 15:46:02    阅读次数:272
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
LeetCode: Best Time to Buy and Sell Stock [121]
【题目】 Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit. ...
分类:其他好文   时间:2014-06-08 15:11:58    阅读次数:298
Restore IP Addresses
题目 Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example: Given "25525511135", return ["255.255.11.135", "255.255.111.3...
分类:其他好文   时间:2014-06-08 10:37:47    阅读次数:273
Project Ruler 算法练习之 Truncate Prime
Project Ruler 算法练习之 Truncate Prime...
分类:其他好文   时间:2014-06-08 10:06:41    阅读次数:174
VMware网络配置文件共享和安装中文输入法
在Ubuntu下我们获取Android源码需要网络,所以VMware一定要配置好网络,安装了VMware后在宿主机的网上邻居中多了两个虚拟网卡,VMnet1、VMnet8,宿主机就是安装VMware的机器。 在客户机上VMWare提供了三种工作模式,host-only(主机模式)、NAT(网络地址转换模式)、bridged(桥接模式)。 打开客户机的配置项 可以看到安装时...
分类:其他好文   时间:2014-06-08 05:08:26    阅读次数:331
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!