POJ 2591】的更多相关文章

四道题的难度: 2591<1338<2545<2247 POJ 2591 Set Definition: 这是从discuss里看来的,写的挺好,直接copy,根据我的代码稍有改动(其实也就只改动了一个数字): 题目所给的是个简单的双递归. 我们注意到任何新的元素必然是集合中较小的元素经过两种之一的递推得到的.这启发我们两个设置标记(比如two,three两个变量):第一个是以方式乘2加1递推,two是没有用过的最小项下标,第二则表示以乘3加1的方式递推,three是没有用过的最小项下标…
#include<iostream> #include<stdio.h> #define MAXN 10000001 using namespace std; int a[MAXN]; void give_set(); int min(int i,int j); int main() { //freopen("acm.acm","r",stdin); give_set(); int num; while(cin>>num) { c…
题目 这道题是个水题,写博客上的人好像都不屑于写这这道题.但是我为什么还是觉得挺难的呢? 我也是看了别人的博客才过了的,感觉这种写法很新颖,这样就可以不用在排序了. 下面给出正解: #include<cstdio> #include<iostream> using namespace std; int S[10000000+5]; int min(int a,int b) { return a<b? a:b; } int main() { int n,i; int a =1,…
[题意简述]:就是有这种一个序列.就拿当p1 = 2,p2 = 3, p3 = 5,来举例.由这三个数为基准组成的序列是: 2,3,4,5,6,8,9,10,12--如今给你这个序列数组的下标,让你求得这个数组中,这个下标里的数是多少. [分析]:2,3,4,5,6,8,9,10,12--这个序列式由2,3,5这三个数生成的,详细怎样生成,就是: 详见代码: 这里以POJ2545为例: //弄清当中的逻辑关系,能够从最简单的2,3,5试着做起! #include<iostream> #incl…
Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798   Special Judge Description Every year there is the same problem at Halloween: Each neighbour is only willing to give a certain total number of sweets…
Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   Special Judge Description The input contains N natural (i.e. positive integer) numbers ( N <= 10000 ). Each of that numbers is not greater than 15000…
The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286   Accepted: 8603   Special Judge Description The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a…
Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Description Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the…
Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Description Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yumm…
Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050   Accepted: 10989 Description Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representatio…