码迷,mamicode.com
首页 >  
搜索关键字:calculate prime s    ( 3428个结果
C++ Prime:switch内部的变量定义
如果需要为某个case分支定义并初始化一个变量,我们应该把变量定义在块内,从而确保后面的所有case标签都在变量的作用域之外。case true: { // 正确,声明语句位于语句块内部 string file_name = get_file_name(...
分类:编程语言   时间:2015-03-12 06:17:18    阅读次数:145
BZOJ 2820 YY的GCD
#include #include #include using namespace std; typedef long long LL; const int maxn = 10000010; int mu[maxn], prime[maxn], vis[maxn], sum[maxn]; int cnt; int a, b; void mobi(int n) { mu[1] = 1;...
分类:其他好文   时间:2015-03-11 17:29:53    阅读次数:113
莫比乌斯模版
#include #include #include using namespace std; typedef long long LL; const int maxn = 100010; int mu[maxn], prime[maxn], vis[maxn]; int cnt; int a, b, c, d, k; void mobi(int n) { mu[1] = 1; for(...
分类:其他好文   时间:2015-03-11 17:29:36    阅读次数:147
HDU Prime Ring Problem _DFS
1 #include 2 #include 3 #include 4 #define M 21 5 #define sc(x) scanf("%d",&x) 6 #define pf(x) printf("%d\n",x) 7 #define PF(x) printf("%d ",x) 8 #de....
分类:其他好文   时间:2015-03-11 16:22:04    阅读次数:222
C++ Prime:预处理器
C++程序会用到的一项预处理功能是头文件保护符,头文件保护符依赖于预处理变量。预处理变量有两种状态:已定义和未定义,#define指令把一个名字设定为预处理变量,另外两个指令则分别检查某个指定的预处理变量是否已经定义:#ifdef当且仅当变量已定义的时候为真,#inndef当且仅当变量未定义时为.....
分类:编程语言   时间:2015-03-11 01:56:02    阅读次数:132
C++ Prime:decltype类型指示符
decltype作用是选择并返回操作数的数据类型。 decltype(f()) sum = x; // sum的类型就是函数f的返回类型 如果decltype使用的表达式是一个变量,则decltype返回该变量的类型(包括顶层const和const在内):const int ci=0, &...
分类:编程语言   时间:2015-03-11 00:43:27    阅读次数:189
POJ3126 Prime Path 打表+BFS
DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a m...
分类:其他好文   时间:2015-03-10 19:29:50    阅读次数:227
524 - Prime Ring Problem
初次接触回溯法,觉得真是很好用,可以减少很多不必要的枚举。 cur变量表示进行到的当前第cur+1个数。 作为A【】的下标出现。 #include using namespace std; int n,vis[20],isp[100],A[30],maxn=0; void dfs(int cur) { if(cur==n&&isp[A[0]+A[n-1]]){ for(...
分类:其他好文   时间:2015-03-10 17:24:11    阅读次数:139
求给定数目的前 n 个素数
bool is_prime (const vector& primes, int num){ for (const auto& prime : primes) { if (num % prime == 0) { return false; } ...
分类:其他好文   时间:2015-03-10 13:26:31    阅读次数:103
杭电1012-u Calculate e
#include#include int main () { printf("n e\n"); printf("- -----------\n"); printf("0 1\n"); printf("1 1\n"); printf("2 2.5\n"); double t=0.5,sum=2....
分类:其他好文   时间:2015-03-10 10:11:14    阅读次数:111
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!