POJ 2081 解题报告
来源:互联网 发布:微信淘宝客发单机器人 编辑:程序博客网 时间:2024/05/21 16:23
这道题是道简单题。我用的set,所以时间巨久。
thestoryofsnow2081Accepted19116K2438MSC++911B/* ID: thestor1 LANG: C++ TASK: poj2081 */#include <iostream>#include <fstream>#include <cmath>#include <cstdio>#include <cstring>#include <limits>#include <string>#include <vector>#include <list>#include <set>#include <map>#include <queue>#include <stack>#include <algorithm>#include <cassert>using namespace std;const int MAXK = 500000;int main(){std::vector<int> Recaman(MAXK + 1, 0);set<int> existed;for (int m = 1; m <= MAXK; ++m){int am = Recaman[m - 1] - m;bool isexisted = !(existed.find(am) == existed.end());if (am <= 0 || isexisted){am = Recaman[m - 1] + m;}Recaman[m] = am;existed.insert(am);}// for (int m = 0; m <= 14; ++m)// {// printf("%d ", Recaman[m]);// }// printf("\n");int k;while (scanf("%d", &k) && k >= 0){printf("%d\n", Recaman[k]);}return 0; }
0 0
- POJ 2081 解题报告
- POJ 2081 Recaman's Sequence 解题报告
- poj解题报告——2081
- poj数百篇解题报告
- poj 1141解题报告
- poj 1001解题报告
- poj 1011 解题报告
- poj 1087 解题报告
- poj 2153解题报告
- poj 2051解题报告
- POJ 1167 解题报告
- poj 1026 解题报告
- POJ 1077 解题报告
- POJ 1042 解题报告
- POJ 1095 解题报告
- POJ 1159解题报告
- poj 2312解题报告
- POJ 1001解题报告
- Android技术文章收集
- [黑马程序员]06[C语言]指针部分笔记总结-01
- 通过金矿模型介绍动态规划 01背包
- [黑马程序员]07[C语言]指针部分笔记总结-02
- 拉格朗日反演
- POJ 2081 解题报告
- PHP常用脚本
- C++学习 - 虚表,虚函数,虚函数表指针学习笔记
- [黑马程序员]08[C语言]数组部分学习总结
- 正则表达式口诀
- java编写九九乘法表
- php项目中代码的调试问题
- VS零散笔记
- IG&IC&Pra 安装教程 在线源方式安装 (无需要电脑联接手机)