码迷,mamicode.com
首页 >  
搜索关键字:calculate prime s    ( 3428个结果
线筛 初见
o(n)的复杂度,筛出各种神奇。bzoj2190仪仗队#include#includeusing namespace std;int phi[40001]={0},prime[40001]={0};bool flag[40001]={false};void work(int n){ int i...
分类:其他好文   时间:2015-02-16 18:19:08    阅读次数:147
Could not calculate build plan maven 2.2
在maven的conf 目录下的settting.xml添加如下配置 <proxies> ????<proxy> ??????<id>optional</id> ??????<active>true</active> ??????<protocol>http</protocol> ??????<host>pro...
分类:其他好文   时间:2015-02-15 13:45:22    阅读次数:213
SPOJ Problem 2: Prime Generator
嗯。。在SPOJ上刷的第二题。一开始不知道哪错了,后来发现i出现了两遍。。因为m#include#includeint n,i,j,t,m,k,tot;int a[100005],b[4000];int prime[40000];int shai(int s){ int i,j; mem...
分类:其他好文   时间:2015-02-14 22:31:29    阅读次数:152
高效素数判断
bool prime(int n){ int i = 7, j, q; if(n == 1) return false; if(n == 2 || n == 5 || n == 3) return true; if(n % 2 == 0 || n % 3 == 0 || ...
分类:其他好文   时间:2015-02-14 11:00:45    阅读次数:130
1081. Rational Sum (20)
时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven N rational numbers in the form "numerator/denominator", you are supposed to calculate ...
分类:其他好文   时间:2015-02-13 18:12:39    阅读次数:135
折半查找算法的使用中防止溢出的问题
维基上的代码: int binary_search(int A[], int key, int imin, int imax) { // continue searching while [imin,imax] is not empty while (imax >= imin) { // calculate the midpoint for roughly equ...
分类:编程语言   时间:2015-02-13 14:49:10    阅读次数:205
hdu 1016 Prime Ring Problem DFS解法 纪念我在杭电的第一百题
A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime. Note: the number of first circle should always be 1. Input n (0 < n < 2...
分类:其他好文   时间:2015-02-12 22:56:33    阅读次数:437
杭电ACM 二 数学求模
Font Size: ← → Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. Given A, B, and n, you are to calculate the value of...
分类:其他好文   时间:2015-02-12 22:50:53    阅读次数:178
【史前巨坑】数论模板整合
跪了一下午数论 整理了一下数论模板 这是个史前巨坑,有空慢慢填 #include #include #include #include #include #define MAXN 1000000 using namespace std; bool not_prime[MAXN]; int prime_number[MAXN]; int nu; int factor[MAXN];//顺手记录一...
分类:其他好文   时间:2015-02-12 21:29:22    阅读次数:178
u Calculate e
问题陈述: 杭州电子科技大学 HANGZHOU DIANZI UNIVERSITY Online Judge Problem - 1012问题解析: 简单题,注意输出格式。引入头文件,调用setprecision()函数设置精度。代码详解: 1 #include 2 #include 3 #...
分类:其他好文   时间:2015-02-12 00:35:00    阅读次数:190
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!