`
hellobin
  • 浏览: 62543 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

UVA 445 - Marvelous Mazes

    博客分类:
  • UVA
 
阅读更多

 

Your mission, if you decide to accept it, is to create a maze drawing program. A maze will consist of the alphabetic charactersA-Z,*(asterisk), and spaces.

 

Input and Output

Your program will get the information for the mazes from the input file. This file will contain lines of characters which your program must interpret to draw a maze. Each row of the maze will be described by a series of numbers and characters, where the numbers before a character tell how many times that character will be used. If there are multiple digits in a number before a character, then the number of times to repeat the character is the sum of the digits before that character.

The lowercase letter "b" will be used in the input file to represent spaces in the maze. The descriptions for different rows in the maze will be separated by an exclamation point (!) or by an end of line.

 

Descriptions for different mazes will be separated by a blank line in both input and output. The input file will be terminated by an end of file.

There is no limit to the number of rows in a maze or the number of mazes in a file, though no row will contain more than 132 characters.

Happy mazing!

 

Sample Input

 

1T1b5T!1T2b1T1b2T!1T1b1T2b2T!1T3b1T1b1T!3T3b1T!1T3b1T1b1T!5T1*1T
 
11X21b1X
4X1b1X

 

Sample Output

 

T TTTTT
T  T TT
T T  TT
T   T T
TTT   T
T   T T
TTTTT*T
 
XX   X
XXXX X

 

 

 

 

 

#define RUN
#ifdef RUN

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <cctype> 
#include <algorithm>
#include <utility>
#include <math.h>

using namespace std;

#define MAXN 105




int main(){

#ifndef ONLINE_JUDGE
	freopen("445.in", "r", stdin);
	freopen("445.out", "w", stdout); 
#endif

	char c;
	bool digit = false;
	int cnt = 0;

	while(scanf("%c", &c) == 1){

		if(c=='!' || c=='\n'){
			printf("\n");
			continue;
		}

		// Output decoded sequence
		if(isalpha(c) || c=='*'){
			for(int i=0; i<cnt; i++){
				if(c == 'b'){
					printf(" ");
				}
				else{
					printf("%c", c);
				}
			}

			cnt = 0;
			continue;
		}

		if(isdigit(c)){
			cnt += (c-'0');
		}
	}




}


#endif



分享到:
评论

相关推荐

    Marvelous Designer英文教学材料

    Marvelous Designer拥有非常直观的服装图案设计功能,你完全可以依据你的喜好,设计理念设计出属于你的风格。软件支持折线,绘制自由曲线和三维立体裁剪同步互动设计,任何形式的修改会立即反映在3D实时立体裁剪服装...

    Marvelous Designer 3 Enterprise_1-4-14-7701x64破解

    Marvelous Designer 3 Enterprise_1-4-14-7701x64破解程序和密码

    marvelous designer教程

    教程,marvelous designer包含了很多很详细的讲解

    Marvelous Techniques

    Marvelous Techniques is a asset package which includes tools to make powerful games with very popular flat atmospheric graphics style used in many top selling games recently. The package suits for ...

    mozclassify:URL 分类算法

    &gt;&gt;&gt; classifier.classify("http://www.coinweek.com/us-coins/the-marvelous-pogue-family-coin-collection-part-2-the-oliver-jung-1833-half-dime/") [u'hobbies & interests', u'coins'] 对于 DFR &gt;&gt;&gt; import ...

    Marvelous Designer与ET-CAD软件的服装仿真应用研究.pdf

    Marvelous Designer与ET-CAD软件的服装仿真应用研究.pdf

    三维虚拟服装设计软件Marvelous Designer 5 v2.3.136 Personal by n0MAD [WIN]

    三维虚拟服装设计软件Marvelous Designer 5 v2.3.136 Personal by n0MAD [WIN];三维虚拟服装设计软件Marvelous Designer 5 v2.3.136 Personal by n0MAD [WIN]

    Marvelous WCMS Framework-开源

    Marvelous WCMS 框架在 GPL v3、快速、简单、PHP5、PDO、OOP、ORM、基于 MVC 的框架下获得许可。 可用作自定义 Web 内容管理系统 (WCMS)、高级或简单网页和其他 Web 应用程序的坚实基础。

    Marvelous Modular Origami

    This richly illustrated book provides step-by-step instructions for the construction of over 30 different modular origami structures. The author describes basic folding techniques required to ...

    marvelous-gulp-webkit:以奇妙的方式构建静态Web的Gulp配方

    然后,在全局安装 $ npm install --global gulp-cli然后,克隆此仓库$ git clone https://github.com/kukuh-sulistyo/marvelous-gulp-webkit.git接下来,安装节点依赖项: $ npm install用法| 您应该将HTML,样式表...

    MarvelComicsAPI接口Marvelous.zip

    Marvelous 提供 iOS 和 OS X 平台的非官方的 Marvel Comics API 原生接口。 标签:Marvelous

    marvelous-aspen-copy-01

    Stackbit方位角主题 由产生该网站 ,v0.2.80。 Stackbit Azimuth主题原始README位于。 该站点的内容由NetlifyCMS管理。... 在本地运行您的网站 从项目菜单中获取“ stackbit-api-key” 运行以下命令将此密钥分配给...

    MarVelous.exe

    MarVelous.exe

    jp.Marvelous.link.apk

    jp.Marvelous.link.apk

    marvelous-movies:电影重塑了GoodReads的克隆

    cd marvelous-movies 安装NPM软件包 npm install 根据您自己的值,基于存储库中包含的.env.example文件创建一个.env文件 使用在PostgreSQL.env文件中指定的用户名和密码在本地计算机上创建用户 创建数据库 npx ...

    marvelous-planet-a9535:使用Stackbit创建的Jamstack网站

    :sparkles: 奇妙的行星 :sparkles: 这是一个使用Git作为的网站。 它是在一分钟内使用创建的。 您可以像这样,或探索一些变体。 如何不同: :artist_palette: 看 :pencil: 不育系 :gear: 静态网站生成器 ...

    marvelous-sparrow-8ca26:用Stackbit创建的Jamstack网站

    :sparkles: 奇异的麻雀 :sparkles: 这是一个使用Git作为的网站。 它是在不到一分钟的时间内使用创建的。 您可以像这样,或探索一些变体。 如何不同: :artist_palette: 看 :pencil: 内容管理系统 ...

    marvelous-kale-5fee9:用Stackbit创建的Jamstack网站

    :sparkles: 奇妙的凯尔 :sparkles: 这是一个使用Git作为的网站。 它是在不到一分钟的时间内使用创建的。 您可以像这样,或探索一些变体。 如何不同: :artist_palette: 看 :pencil: 内容管理系统 ...

    marvelous-owl-3c9c2:用Stackbit创建的Jamstack网站

    :sparkles: 奇妙的猫头鹰 :sparkles: 这是一个使用Git作为的网站。 它是在不到一分钟的时间内使用创建的。 您可以像这样,或探索一些变体。 如何不同: :artist_palette: 看 :pencil: 内容管理系统 ...

    marvelous-bot:clojure 奇妙的 irc bot

    了不起,clojure irc 超级机器人! 一个使用 clojure 实现的智能简单的 irc bot Clojure 冒险 使用最新的 clojure 版本 你好,世界! 打印数组 使用第三方“第三方”模块 Clojure 特定的 IDE(灯表和夜间代码...

Global site tag (gtag.js) - Google Analytics