1 #include 2 #include 3 #define N 99999 4 5 using namespace std; 6 7 bool flag[N]; 8 9 void prime()10 {11 for (int i = 2; i < N; i++)12 ...
分类:
其他好文 时间:
2014-12-27 17:18:30
阅读次数:
130
#include
#include
using namespace std;
int n,map[30],vis[30];
void dfs(int s[30], int x, int vis[30])
{
int i, t, j,flag;
if(x==n-1)
{
flag=0;
t=s[x]+1;
for(j=2;j...
分类:
其他好文 时间:
2014-12-25 23:45:03
阅读次数:
423
Design an algorithm to find the kth number such that the only prime factors are 3, 5, and 7.The eligible numbers are like 3, 5, 7, 9, 15 ...ExampleIf ...
分类:
其他好文 时间:
2014-12-25 08:43:45
阅读次数:
240
1 #include 2 3 int main(void) 4 { 5 const int len = 100; 6 int prime[len]; 7 for (int i=0; i<len; i++) 8 prime[i] = 1; // 1 标记这...
分类:
其他好文 时间:
2014-12-23 16:57:34
阅读次数:
190
Could not calculate build plan: Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from http://repo1.maven.org/maven2 was ca...
分类:
系统相关 时间:
2014-12-22 21:04:37
阅读次数:
225
Problem Description
Give you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj...
分类:
编程语言 时间:
2014-12-22 16:17:44
阅读次数:
252
题目大意:同2154 多组数据
后面那坨东西 由于积性函数的约数和仍是积性函数 因此只需要线性筛一下就行
i%prime[j]==0那部分由于多出来的因数都不是无平方因子数因此μ值都为0 增加的只有原先的D/i
#include
#include
#include
#include
#define M 10001000
#define MOD 100000009
using ...
分类:
其他好文 时间:
2014-12-22 14:34:59
阅读次数:
126
题目描述:
Output the k-th prime number.
输入:
k≤10000
输出:
The k-th prime number.
样例输入:
3
7
样例输出:
5
17
来源: 2008年上海交通大学计算机研究生机试真题
答疑: 解题遇到问题?分享解题心得?讨论本题请访问:http://t.jobdu.com/threa...
分类:
其他好文 时间:
2014-12-22 11:13:30
阅读次数:
182
原题:Prime GeneratorProblem code: PRIME1Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime nu...
分类:
其他好文 时间:
2014-12-20 16:45:38
阅读次数:
179
newLISP实现了Cilk API, 可以将多个同时运行的进程执行在多处理器或者多核的CPU架构上,已达到并行节省运行时间的目的。使用spawn和sync函数可以很快的实现。下面是来自newLISP官方文档的例子:#!/usr/bin/newlisp
; calculate primes in a range
(define (primes from to)
(local (plist)...
分类:
系统相关 时间:
2014-12-20 14:17:19
阅读次数:
207