Poj 2081 Recaman's Sequence之解题报告】的更多相关文章

                                                                                                      Recaman's Sequence Time Limit: 3000MS   Memory Limit: 60000K Total Submissions: 22363   Accepted: 9605 Description The Recaman's sequence is defined…
Recaman's Sequence Time Limit: 3000ms Memory Limit: 60000KB This problem will be judged on PKU. Original ID: 208164-bit integer IO format: %lld      Java class name: Main   The Recaman's sequence is defined by a0 = 0 ; for m > 0, am = am−1 − m if the…
Recaman's Sequence Time Limit: 3000MS   Memory Limit: 60000K Total Submissions: 22566   Accepted: 9697 Description The Recaman's sequence is defined by a0 = 0 ; for m > 0, am = am−1 − m if the rsulting am is positive and not already in the sequence,…
開始还以为暴力做不出来,须要找规律,找了半天找不出来.原来直接暴力.. 代码例如以下: #include<stdio.h> int a[1000050]; int b[100000000]={0}; int main() { int i,k; a[0]=0; for(i=1;i<=500000;i++) { a[i]=a[i-1]-i; if(a[i-1]-i>0&&!b[a[i-1]-i]) a[i]=a[i-1]-i; else a[i]=a[i-1]+i; b…
[简要题意]:这个主题是很短的叙述性说明.挺easy. 不重复. [分析]:只需要加一个判断这个数是否可以是一个数组,这个数组的范围. // 3388K 0Ms #include<iostream> using namespace std; #define Max 500001 int a[Max]; bool b[10000000] = {false}; // b的数据范围是能够试出来的- void init() { a[0] = 0; b[0] = true; for(int m = 1;…
That Nice Euler Circuit Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 1975   Accepted: 624 Description Little Joey invented a scrabble machine that he called Euler, after the great mathematician. In his primary school Joey heard about…
题目链接:http://poj.org/problem?id=1094 题目意思:给出 n 个待排序的字母 和 m 种关系,问需要读到第 几 行可以确定这些字母的排列顺序或者有矛盾的地方,又或者虽然具体的字母顺序不能确定但至少不矛盾.这些关系均是这样的一种形式: 字母1 < 字母2 这道题目属于图论上的拓扑排序,由于要知道读入第几行可以确定具体的顺序,所以每次读入都需要进行拓扑排序来检验,这时每个点的入度就需要存储起来,所以就有了代码中memcpy 的使用了. 拓扑排序的思路很容易理解,但写起来…
World Cup Noise Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 16369   Accepted: 8095 Description Background "KO-RE-A, KO-RE-A" shout 54.000 happy football fans after their team has reached the semifinals of the FIFA World Cup in t…
Is It A Tree? Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 32052   Accepted: 10876 Description A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edg…
Strange Towers of Hanoi 大体意思是要求\(n\)盘4的的hanoi tower问题. 总所周知,\(n\)盘3塔有递推公式\(d[i]=dp[i-1]*2+1\) 令\(f[i]\)为4塔转移步骤. \(f[i]=min(f[i],f[k]*2+d[i-k])\) 即先以4塔以上面的\(k\),再以3塔移\(i-k\),最后以4塔移动回去. 可以推广到\(n\)盘\(m\)塔 2018.5.26…