POJ 1595 素数打表水题】的更多相关文章

[题意简述]:给出N和C,让我们求出N以内的包含N的素数,然后依据若N以内的素数为奇数个,就将中间2*c-1个素数输出:若为偶数个.就将中间2*c个素数输出. [分析]:仅仅要题意理解就简单了. 详见代码: // 224K 16Ms #include<iostream> using namespace std; #define N 2000 bool isprime[N]; int prime[N],nprime; void doprime(int n) { int i,j; nprime =…
http://acm.hdu.edu.cn/showproblem.php?pid=5104 找元组数量,满足p1<=p2<=p3且p1+p2+p3=n且都是素数 不用素数打表都能过,数据弱的一比 #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include <queue> #inclu…
题目:http://poj.org/problem?id=3080 水题,暴搜 #include <iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<stack> #include<queue> #include<iomanip> #include<cmath> #include<map> #include…
Prime Cuts Time Limit: 1000MSMemory Limit: 10000K Total Submissions: 10464Accepted: 3994 Description A prime number is a counting number (1, 2, 3, ...) that is evenly divisible only by 1 and itself. In this problem you are to write a program that wil…
题目链接:http://poj.org/problem?id=3984 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, }; 它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线. Input 一个5 × 5的二维数组,表示一个迷宫.数据保证有…
DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 80832   Accepted: 32533 Description One measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instanc…
Financial Management Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 126087   Accepted: 55836 Description Larry graduated this year and finally has a job. He's making a lot of money, but somehow never seems to have enough. Larry has deci…
题意:给定一个金字塔,第 i 行有 i 个数,从最上面走下来,只能相邻的层数,问你最大的和. 析:真是水题,学过DP的都会,就不说了. 代码如下: #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include <cstring> #include <set> #include <…
一.Description Eva的家庭作业里有很多数列填空练习.填空练习的要求是:已知数列的前四项,填出第五项.因为已经知道这些数列只可能是等差或等比数列,她决定写一个程序来完成这些练习. Input 第一行是数列的数目t(0 <= t <= 20).以下每行均包含四个整数,表示数列的前四项.约定数列的前五项均为不大于10^5的自然数,等比数列的比值也是自然数. Output 对输入的每个数列,输出它的前五项. 二.题解      又是水题啊,感觉不能这样下去了,不然我自己也变水了. 三.j…
POJ 1401 Factorial Time Limit:1500MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu   Description The most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this ter…