poj 1208 The Blocks Problem 模拟+vector的使用
来源:互联网 发布:淘宝教育怎么入驻 编辑:程序博客网 时间:2024/05/18 04:52
模拟水题,直接贴代码,主要是vector的使用。
//poj 1208//sep9#include <iostream>#include <vector>using namespace std;const int maxN=32;vector<int> v[maxN],tmp;char a[32],b[32];int n,x,y,a1,a2,b1,b2;void get_address(){int i,j;for(i=0;i<n;++i)for(j=0;j<v[i].size();++j)if(v[i][j]==x){a1=i;b1=j;}for(i=0;i<n;++i)for(j=0;j<v[i].size();++j)if(v[i][j]==y){a2=i;b2=j;}}void show(){int i,j;for(i=0;i<n;++i){printf("%d:",i);for(j=0;j<v[i].size();++j)printf("% d",v[i][j]);printf("\n");}}void a_move_back(){int i;tmp.clear();for(i=b1+1;i<v[a1].size();++i)tmp.push_back(v[a1][i]);v[a1].erase(v[a1].begin()+b1+1,v[a1].end());for(i=0;i<tmp.size();++i){int x=tmp[i];v[x].insert(v[x].begin(),x);}}void b_move_back(){int i;tmp.clear();for(i=b2+1;i<v[a2].size();++i)tmp.push_back(v[a2][i]);v[a2].erase(v[a2].begin()+b2+1,v[a2].end());for(i=0;i<tmp.size();++i){int x=tmp[i];v[x].insert(v[x].begin(),x);}}
0 0
- poj 1208 The Blocks Problem 模拟+vector的使用
- POJ 1208 The Blocks Problem [模拟]
- POJ 1208 The Blocks Problem(模拟)
- POJ-模拟-1208 The Blocks Problem
- uva 101 POJ 1208 The Blocks Problem 木块问题 vector模拟
- poj1208 The Blocks Problem,模拟,vector
- POJ 1208 The Blocks Problem 简单栈模拟
- POJ 1208 The Blocks Problem 栈模拟 练STL
- uva-101 && poj 1208 The Blocks Problem (模拟栈)
- poj 1208 The Blocks Problem (链表模拟)
- UVa101-The Blocks Problem/STL-Vector的使用
- vector-- The Blocks Problem
- poj 1208 The Blocks Problem
- POJ 1208 The Blocks Problem
- POJ-1208-The Blocks Problem
- poj 1208 The Blocks Problem
- POJ 1208 The Blocks Problem
- POJ 1208 The Blocks Problem
- selecter的使用,用简单例子来说明吧
- PRINTER_INFO_2 structure
- AddPrinterDriver function
- EnumPrintProcessors function
- DRIVER_INFO_6 structure
- poj 1208 The Blocks Problem 模拟+vector的使用
- Android多线程断点下载文件
- Longest Substring Without Repeating Characters
- Leetcode - Add Binary -Jan 30, 2015
- poj 2160 Box 模拟
- DevCon 命令行实用工具可替代设备管理器
- HTML5 声明兼容IE的写法
- 养成定时更新内容的好习惯,提高搜索引擎时效性收录
- lv官方網 wqdx axsr jguq