POJ 2081 Recaman's Sequence G++ 散列表的范围是博友求出来的
来源:互联网 发布:薛之谦淘宝店铺地址 编辑:程序博客网 时间:2024/06/04 00:34
#include <iostream>#include <vector>//谢谢博友文章 3012501这个数是博友求出来的 using namespace std;int a[500001];int hash[3012501];int main(){a[0]=0;hash[0]=1;//int max=0;for(int i=1;i<500001;i++){if(a[i-1]>i){if(hash[a[i-1]-i]==0){a[i]=a[i-1]-i;hash[a[i-1]-i]=1;}else{a[i]=a[i-1]+i;hash[a[i-1]+i]=1; }}else{a[i]=a[i-1]+i;hash[a[i-1]+i]=1;}/*if(a[i]>max){max=a[i];}*/}//cout<<max<<endl;//3012500//cout<<a[500000]<<endl;//626684vector<int> jg;while(1){int t;cin>>t;if(t==-1){break;}jg.push_back(a[t]);}for(int i=0;i<jg.size();i++){cout<<jg[i]<<endl;}return 0;}
0 0
- POJ 2081 Recaman's Sequence G++ 散列表的范围是博友求出来的
- POJ 2081 Recaman's Sequence
- poj 2081 Recaman's Sequence
- POJ 2081 Recaman's Sequence
- poj 2081 :Recaman's Sequence
- poj 2081Recaman's Sequence
- poj 2081 Recaman's Sequence
- POJ 2081 Recaman's Sequence
- POJ-2081:Recaman's Sequence
- POJ-2081-Recaman's Sequence
- poj 2081 Recaman's Sequence
- POJ 2081 Recaman's Sequence
- POJ 2081 Recaman's Sequence
- POJ 2081 Recaman's Sequence
- poj 2081 Recaman's Sequence
- POJ 2081 Recaman's Sequence
- poj 2081【Recaman's Sequence】
- POJ 2081 Recaman's Sequence
- React Native 第三方库下载失败 no such file or directory open ...
- Yarn包管理工具使用总结
- Java并发编程——Condition接口
- notepad++ 怎么给单行字体设置格式颜色
- Spring缓存注解@Cacheable、@CacheEvict、@CachePut使用注意点
- POJ 2081 Recaman's Sequence G++ 散列表的范围是博友求出来的
- 每天一个Linux命令(17):whereis
- 单链表实现栈
- Android数据存储和访问之SharedPreferences存储方式_用户登录记住密码案例
- Lintcode14 First Position of Target Solution 题解
- css3中的新特性经典应用
- 20170408_OSI参考模型与TCP/IP模型与输入URL地址按下enter键以后发生了什么?
- leetcode解题之 77. Combinations&78. Subsets&90. Subsets II java 版(求所有子集)
- 资源列表