码迷,mamicode.com
首页 >  
搜索关键字:prime    ( 2475个结果
LeetCode: Ugly Number
题目链接:https://leetcode.com/problems/ugly-number/ 题目: Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5....
分类:其他好文   时间:2015-08-19 13:33:56    阅读次数:400
欧拉函数模板
kb2.7.1分解质因数求欧拉函数#include#include#includeusing namespace std;//素数筛选和合数分解const int MAXN=10000;int prime[MAXN+1];void getPrime(){ memset(prime,0,size...
分类:其他好文   时间:2015-08-19 12:59:48    阅读次数:148
SPFA,dijskra,prime,topu四种算法的模板
1 ////#include 2 ////#include 3 ////#include 4 ////#include 5 ////using namespace std; 6 ////const int INF=0x3f3f3f3f; 7 ////const int MAXN=11...
分类:编程语言   时间:2015-08-19 12:48:09    阅读次数:249
[LeetCode] Ugly Number II (A New Question Added Today)
Write a program to find then-th ugly number.Ugly numbers are positive numbers whose prime factors only include2, 3, 5. For example,1, 2, 3, 4, 5, 6, 8...
分类:其他好文   时间:2015-08-19 12:44:18    阅读次数:108
poj 3126 Prime Path (BFS)
Prime PathTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 14276Accepted: 8045DescriptionThe ministers of the cabinet were quite upset by the ...
分类:其他好文   时间:2015-08-19 10:53:27    阅读次数:148
[LeetCode] Ugly Number (A New Question Added Today)
Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include2, 3, 5. For examp...
分类:其他好文   时间:2015-08-19 10:35:55    阅读次数:91
大数筛选
//模板一#include#include using namespace std;const long N = 10000001;long prime[N] = {0}, num_prime = 0;int isNotPrime[N] = {1, 1};int main(){ for(lon...
分类:其他好文   时间:2015-08-19 09:23:16    阅读次数:99
hdoj 1016 Prime Ring Problem
Problem DescriptionA ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of num...
分类:其他好文   时间:2015-08-18 21:04:45    阅读次数:150
HDU 4463 Outlets (prime_杭州区域赛水题)
Problem Description In China, foreign brand commodities are often much more expensive than abroad. The main reason is that we Chinese people tend to think foreign things are better and we are willi...
分类:其他好文   时间:2015-08-17 19:41:16    阅读次数:139
最小代价生成树
#include using namespace std; const int Max = 100; int p[Max][Max]; const int maxCost = 99; int lowcost[Max]; int nearest[Max]; bool mark[Max]; void Prime(int k,int n) { memset(lowcost, 99, sizeof(lo...
分类:其他好文   时间:2015-08-17 19:37:47    阅读次数:117
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!