POJ 2081 Recaman's Sequence
来源:互联网 发布:动漫人物 性格 知乎 编辑:程序博客网 时间:2024/05/13 09:52
题意:
典型水题
思路:
打表
代码:
#include<stdio.h>int a[500010],vis[50000010];int main(){ int k,S,most=0; vis[0]=1; while(scanf("%d",&k)!=EOF) { if(k==-1) break; for(int i=most+1; i<=k; i++) { a[i]=a[i-1]-i; if(a[i]<=0||(a[i]>0&&vis[a[i]]==1)) a[i]=a[i]+2*i; vis[a[i]]=1; } if(most<k) most=k; printf("%d\n",a[k]); }}
0 0
- 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
- POJ-2081 Recaman's Sequence
- 做一件事难得的是坚持
- Cocos2d-x2.0 -- 从点,线,面学起
- HDOJ 2025
- ExecutorService中submit和execute的区别、Callable 的用法
- 记录学习画漫画的过程~~2014.7.10(人物头像)
- POJ 2081 Recaman's Sequence
- HDU 2059 —龟兔赛跑
- org.apache.commons.dbcp.BasicDataSource 连接池配备属性解析及范例
- IIS7.5中神秘的ApplicationPoolIdentity
- Linux串口读写
- 我第一次配置svn服务器并初始化
- Android學習_唯一值(Android_id、IMEI、Wifi MAC)
- 51、实例 使用jQuery管理事件之自定义事件
- 轻松地实现PDF文件转PPT的pdf转换器