E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
Recaman
C#,雷卡曼数(Recamán Number)的算法与源代码
1雷卡曼数(RecamánNumber)雷卡曼数(RecamánNumber),即
Recaman
序列被定义如下:(1)a[0]=0;(2)如果a[m-1]-m>0并且这个值在序列中不存在,则a[m]=a
深度混淆
·
2024-02-08 11:53
C#算法演义
Algorithm
Recipes
c#
算法
Recaman
数字序列
刚刚交了一道题目,总结一下
5000000]={0};//ifanintegerisnotused,themarkis0intmain(void){longinti,k;longintm;for(i=0;i0&&used[m]==0)
recaman
Phoenix-Ikki
·
2020-08-22 17:31
POJ 2081
Recaman
's Sequence
Recaman
'sSequenceTimeLimit:3000MS MemoryLimit:60000KB 64bitIOFormat:%I64d&%I64uSubmit StatusDescriptionTheRecaman'ssequenceisdefinedbya0
jinjide_ajin
·
2016-05-11 21:00
poj 2081
Recaman
's Sequence
Recaman
'sSequenceTimeLimit: 3000MS MemoryLimit: 60000KTotalSubmissions: 22529 Accepted: 9678DescriptionTheRecaman'ssequenceisdefinedbya0
Z_huing
·
2016-05-11 18:00
Recaman
's Sequence
Recaman
'sSequenceTimeLimit:3000MS MemoryLimit:60000KB 64bitIOFormat:%I64d&%I64uSubmit StatusDescriptionTheRecaman'ssequenceisdefinedbya0
mr_fan_123
·
2016-05-11 17:00
poj2081
Recaman
's Sequence
C-
Recaman
'sSequenceCrawlinginprocess...CrawlingfailedTimeLimit:3000MS MemoryLimit:60000KB 64bitIOFormat
su20145104009
·
2016-05-11 10:00
poj
2081
poj2081
POJ-2081
Recaman
's Sequence
Recaman
’sSequenceTimeLimit:3000MSMemoryLimit:60000KTotalSubmissions:22392Accepted:9614DescriptionTheRecaman
Dacc123
·
2016-01-07 19:00
POJ 2081
Recaman
's Sequence
这是一道要打表的递推题。注意数组开得足够大就行。 #include<cstdio> #include<cstring> #include<cstdlib> bool vis[4000000] = {false};//记录一个数是否出现在结果中 int a[500005]; void init() { a[0] =
·
2015-11-13 03:56
sequence
POJ2081(
Recaman
's Sequence)
题目链接 简单动态规划题。 View Code 1 #include <stdio.h> 2 #include <string.h> 3 #define N 500002 4 #define MAX 10000000 5 char vis[MAX]; 6 int c[N]; 7 int main() 8 { 9 int n,i,tmp; 10
·
2015-11-12 22:47
sequence
动态规划练习 索引
1, The Triangle (POJ 1163) 2, Function Run Fun (POJ 1579) 3,
Recaman
's Sequence (POJ 2081) 4, World
·
2015-11-09 12:45
动态规划
动态规划练习 3
题目:
Recaman
's Sequence (POJ 2081) 链接:http://acm.pku.edu.cn/JudgeOnline/problem?
·
2015-11-09 12:06
动态规划
pku2081----
Recaman
's Sequence(按所给的递推公式来做就行)
5196K 16MS G++ 414B 刚开始还苦恼着要不要自己重新再推一个公式出来 后来发现他给的空间和时间限制,应该是足够的,就试了一下,结果就是上面这样子。 题目思路就是:首先生成结果 主程序里直接调用就可以了。 代码如下: Code #include<stdio.h> #include<string.h>
·
2015-11-01 13:10
sequence
poj2081
Recaman
's Sequence Time Limit: 3000MS Memory Limit: 60000K Total Submissions: 
·
2015-10-31 10:15
poj
POJ 2081
Recaman
's Sequence
Recaman
's Sequence Time Limit: 3000ms Memory Limit: 60000KB This problem will be judged on
·
2015-10-31 08:28
sequence
POJ 2081
Recaman
's Sequence Time Limit: 3000MS Memory Limit: 60000K Total Submissions: 18575
·
2015-10-27 16:31
poj
POJ 2081
Recaman
's Sequence(水~)
Description第m个位置的数是根据第m-1位置的数推出来的如果a[m-1]-m>0,并且a[m-1]-m在前面的序列中没有出现过那么a[m]=a[m-1]-m否则a[m]=a[m-1]+m,a[0]=0Input多组用例,每组一个整数m表示查询该位置的值,以m=-1结束输入Output对于每个查询,输出相应位置的值SampleInput710000-1SampleOutput2018658
V5ZSQ
·
2015-08-26 16:00
poj 杂题 - 2081
Recaman
's Sequence
这道题目一开始就能知道考点在如何缩短查找时间。所以加快查找是我们的重点。但是在大数据面前,查找算法都不够快,所以我们用简单的hash思想来做。我们开一个数组a,当出现了一个数b时,把该数作为下标调整值,即a[b]=-1,下一次出现该值的时候直接去找这个值作为下标的a值是否为-1即可。#include #include #defineMAX5000010 intp[MAX]={0}; ints[MA
u010006643
·
2015-05-11 15:00
poj
poj 2081【
Recaman
's Sequence】
DescriptionTheRecaman'ssequenceisdefinedbya0=0;form>0,a m =a m−1 −mifthersultinga m ispositiveandnotalreadyinthesequence,otherwisea m =a m−1 +m. ThefirstfewnumbersintheRecaman'sSequenceis0,1,3,6,2,7,1
u012970471
·
2015-04-14 11:00
动态规划EZ---
Recaman
序列
RecamanSequence:
Recaman
序列被定义如下:(1)a[0]=0;(2)如果a[m-1]-m>0并且这个值在序列中不存在,则a[m]=a[m-1]-m;(3)否则a[m]=a[m-1]+
qq978874169
·
2015-04-13 21:00
C++
POJ 2081
Recaman
's Sequence
DescriptionTheRecaman'ssequenceisdefinedbya0=0;form>0,am =am−1 −mifthersultingam ispositiveandnotalreadyinthesequence,otherwiseam =am−1+m. ThefirstfewnumbersintheRecaman'sSequenceis0,1,3,6,2,7,13,20,1
Misdom_Tian_Ya
·
2015-03-17 17:00
poj 2081
Recaman
's Sequence【hash】
题目意思不难理解就是第m个位置的数是根据第m-1位置的数推出来的如果a[m-1]-m>0,并且a[m-1]-m在前面的序列中没有出现过那么a[m]=a[m-1]-m否则a[m]=a[m-1]+m另外唯一需要注意的一点就是hash数组开大一点。//打表 #include #include usingnamespacestd; constintMAXN=500003; inta[MAXN]={
Scythe666
·
2014-08-04 10:00
POJ2081:
Recaman
's Sequence
DescriptionTheRecaman'ssequenceisdefinedbya0=0;form>0,am=am−1−mifthersultingamispositiveandnotalreadyinthesequence,otherwiseam=am−1+m.ThefirstfewnumbersintheRecaman'sSequenceis0,1,3,6,2,7,13,20,12,21,
libin56842
·
2014-03-01 21:00
poj
水
ZOJ 2421
Recaman
's Sequence
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1421题目大意:定义a^m为 a^m=a^(m-1)-m 如果a^m为正且没有出现过。否则a^m=a^(m-1)+m。给你k,让你求a^k思路:打表。k最大为50万,而a[500000] constintMAXK=500000+2; constintMAXN=630000; in
murmured
·
2014-02-08 21:00
编程
数学
ACM
ZOJ
poj_2081
Recaman
'sSequenceTimeLimit: 3000MS MemoryLimit: 60000KTotalSubmissions: 19016 Accepted: 7963DescriptionTheRecaman'ssequenceisdefinedbya0
lgh1992314
·
2012-12-03 10:00
ZOJ2421
Recaman
's Sequence
ZOJ的水题怎么老是那么奇葩~~今天真是好好见识了ZOJ的编译器的各种奇葩~~头文件加多了竟然会RE~~囧。。以往我都是头文件一坨坨的堆的~~~简单打表:ACprogram: #include usingnamespacestd; intpp[500100]; intff[10000100];// intmain() { pp[0]=0; ff[0]=1; inttmp; for(inti=1;
kg_second
·
2012-10-10 18:00
POJ 2081
Recaman
's Sequence -- from lanshui_Yang
DescriptionTheRecaman'ssequenceisdefinedbya0=0;form>0,am =am−1 −mifthersultingam ispositiveandnotalreadyinthesequence,otherwiseam =am−1 +m. ThefirstfewnumbersintheRecaman'sSequenceis0,1,3,6,2,7,13,20,
lanshui_Yang
·
2012-08-10 17:00
Integer
input
each
output
Numbers
[ACM_POJ_2081]动态规划入门练习(三)
Recaman
's Sequence
Recaman
's Sequence Time Limit: 3000MS Memory Limit: 60000K Total Submissions: 17939 Accepted: 7450
txf2004
·
2012-04-04 12:00
sequence
poj 2081
Recaman
's Sequence
/* Name:poj2081
Recaman
'sSequence Author:Unimen Date:07-05-1103:12 Description:动规水题 */ /* 解题报告:动规水题 唯一的注意点为
Unimen
·
2012-03-11 23:00
POJ 2081
Recaman
's Sequence(我的水题之路——空间换时间)
Recaman
'sSequenceTimeLimit: 3000MS MemoryLimit: 60000KTotalSubmissions: 17688 Accepted: 7349DescriptionTheRecaman'ssequenceisdefinedbya0
shiow1991
·
2012-02-08 22:00
POJ 2081
Recaman
's Sequence
题目链接:http://poj.org/problem?id=2081 分析:就是要求一系列数字,如果a[i-1]-i>0 则:ai=a[i-1]-i,否则的话 ai=a[i-1]+i,同时要满足这些数字在之前没有出现过。 源代码://POJ2081AC #include usingnamespacestd; inta[500010]; boolflag[3500000]={false
jiahui524
·
2011-08-02 11:00
POJ 2081
Recaman
's Sequence
用一个数组储存数列中的数,一个数组储存出现过的数即可..#include usingnamespacestd; inta[500001]; intpos[5000001]//开的有点大。。反正内存够用。。; intmain(){ for(inti=0;i0&&pos[t]==0)a[i]=t; elsea[i]=a[i-1]+i; pos[a[i]]=1; } intn; while(scanf(
swm8023
·
2011-07-13 18:00
POJ-2081-
Recaman
's Sequence-Hash思想解题
#include#include#includeusingnamespacestd;constintMAX_K=500002;constintMOD_VAL=499991;inta[MAX_K];vectorhash[MOD_VAL];//hash表项中存储的是一个实际的数boolisIn(intn){intkey=n%MOD_VAL;for(vector::size_typei=0;i!=has
lihao21
·
2011-03-09 15:00
存储
include
Pku acm 2081
Recaman
's Sequence 动态规划题目解题报告(三)
http://acm.pku.edu.cn/JudgeOnline/problem?id=2081一道很简单的动态规划,根据一个递推公式求一个序列,我选择顺序的求解,即自底向上的递推,一个int数组result根据前面的值依此求出序列的每一个结果,另外一个boolean数组flag[i]记录i是否已经出现在序列中,求result的时候用得着,这样就避免了查找。核心的java代码为:for(i=1;
china8848
·
2008-01-01 10:00
Recaman
's Sequence
问题描述: TheRecaman'ssequenceisdefinedbya0=0;form>0,am=am-1-mifthersultingamispositiveandnotalreadyinthesequence,otherwiseam=am-1+m.ThefirstfewnumbersintheRecaman'sSequenceis0,1,3,6,2,7,13,20,12,21,11,
fisher_jiang
·
2006-04-21 14:00
Integer
input
each
iostream
output
Numbers
上一页
1
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他