poj2739】的更多相关文章

POJ2739 Sum of Consecutive Prime Numbers 题目大意:给出一个整数,如果有一段连续的素数之和等于该数,即满足要求,求出这种连续的素数的个数 水题:艾氏筛法打表+尺取法区间推进,0ms水过(注意循环的终止条件) #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <ctime> #include &l…
都是很简单的题目 poj2739素数打表+单点推移 #include<iostream> #include<cstring> #include<cstdio> using namespace std; int cnt,n; ]; ] = {,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,…
2017-09-01 17:04:45 writer:pprp 一开始读错题了,总是想不到,其实不是很难,但是就是心理太着急了,反而浪费了很长时间 /* @param:poj2739 @writer:pprp @declare: @begin:11:50 @end:16:59 @error:各种取等条件,包括审题上也出现了重大失误 @date:2017/9/1 */ #include <iostream> #include <cstdio> #include <cmath&g…
题目大意 给定N,要求你计算用连续的素数的和能够组成N的种数 题解 先筛选出素数,然后暴力判断即可... 代码: #include<iostream> #include<cstring> using namespace std; #define MAXN 10000 ],cnt; ]; void get_prime() { cnt=; memset(check,false,sizeof(check)); ;i<=MAXN;i++) { if(!check[i]) prime[…
                                                                                       Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 18427   Accepted: 10122 Description Some positive integers can be rep…
简单的素数打表,然后枚举.开始没注意n读到0结束,TLE了回..下次再认真点.A过后讨论里面有个暴力打表过的,给跪了! #include <iostream> #include <cstdlib> #include <cstdio> #include <cstring> #include <algorithm> #include <cctype> #include <complex.h> #include <cmat…
Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given positive integer have? For example, the integer 53 has two representations 5 + 7 + 11 + 13 + 17 and 53. The intege…
题意:给你一个数,问这个数能否等于一系列连续的质数的和: 解题思路:质数筛打出质数表:然后就是尺取法解决: 代码: #include<iostream> #include<algorithm> #include<cstring> #define maxn 1000005 using namespace std; int visit[maxn];int prime[maxn]; void qprime() { memset(visit,,sizeof(visit)); ;…
Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 25225   Accepted: 13757 Description Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representatio…
Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 23931   Accepted: 13044 Description Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representatio…