POJ 1573 Robot Motion
来源:互联网 发布:碧凡化妆品专营店 知乎 编辑:程序博客网 时间:2024/05/16 09:42
水模拟题一只。。。
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>using namespace std;int cnt[1000][1000],n,m,lc,s;char map[1000][1000];int go(int x,int y){ while (1) { if (x < 0 || y < 0 || x >= n || y >= m) { printf("%d step(s) to exit\n",lc-1); break; } if (cnt[x][y] != 0) { printf("%d step(s) before a loop of %d step(s)\n",cnt[x][y]-1,lc-cnt[x][y]); break; } cnt[x][y]=lc; lc++; switch (map[x][y]) { case 'N': x--; break; case 'S': x++; break; case 'E': y++; break; case 'W': y--; break; } }}int main(){ int i,j,k; while (1) { scanf("%d%d%d",&n,&m,&s); getchar(); if (n == 0 && m == 0 && s == 0) { break; } s--; memset(cnt,0,sizeof(cnt)); for (i=0; i<n; i++) { gets(map[i]); } lc=1; go(0,s); }}
- poj 1573 Robot Motion
- Poj 1573 Robot Motion
- poj 1573 Robot Motion
- POJ 1573 - Robot Motion
- poj-1573-Robot Motion
- POJ 1573 Robot Motion
- POJ 1573 Robot Motion
- POJ-1573-Robot Motion
- poj 1573 Robot Motion
- POJ 1573 Robot Motion
- POJ 1573 Robot Motion.
- poj 1573 Robot Motion
- POJ -1573 Robot Motion
- POJ 1573:Robot Motion
- poj 1573 Robot Motion
- poj 1573 Robot Motion
- POJ 1573 Robot Motion
- Robot Motion POJ 1573
- 云计算中存储必备的 9 大要素
- mysql replace into用法详细说明
- ElasticSearch相关软件下载地址
- Shell中脚本变量和函数变量的作用域
- Appache HTTP Server相关配置项的修改
- POJ 1573 Robot Motion
- 23种设计模式 之 Template模式(模板模式)[C语言]
- boost utility
- 新时尚Windows8开发(32):Json数据处理(A)
- boost uuid
- MySQL索引背后的数据结构及算法原理(b+树)
- 一本超好的黑客编程书籍。我朋友写的
- 图片异步加载,缓存的开源库
- property