F - Marvelous Mazes

Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu

Description

 

Your mission, if you decide to accept it, is to create a maze drawing program. A maze will consist of the alphabetic characters A-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
#include<bits/stdc++.h>
using namespace std;
int main()
{
char s[];
int sum=;
while(gets(s))
{
int len=strlen(s);
for(int i=;i<len;i++)
{
if(s[i]>=''&&s[i]<='')
{
sum+=s[i]-'';
}
else if(s[i]=='!')
{
cout<<endl;
}
else if(s[i]=='b')
{
for(int j=;j<sum;j++)
cout<<' ';
sum=;
}
else
{
for(int j=;j<sum;j++)
{
cout<<s[i];
}
sum=;
} }
cout<<endl; }
}

这里读取说的比较高级,但是用一个gets就解决了,因为它可以读取\n,水

Marvelous Mazes的更多相关文章

  1. UVa 445 - Marvelous Mazes

    https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=s ...

  2. Marvelous Mazes UVA - 445

    #include<iostream> #include<stdio.h> #include<string> #include<cstring> #def ...

  3. UVA_445:Marvelous Mazes

    Language:C++ 4.8.2 #include<stdio.h> #include<string.h> #include<ctype.h> int main ...

  4. UVA题目分类

    题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...

  5. 【索引】Volume 0. Getting Started

    AOAPC I: Beginning Algorithm Contests (Rujia Liu) Volume 0. Getting Started 10055 - Hashmat the Brav ...

  6. TOJ 2017: N-Credible Mazes

    2017: N-Credible Mazes  Time Limit(Common/Java):1000MS/10000MS     Memory Limit:65536KByteTotal Subm ...

  7. CodeForce 377 A mazes(dfs+连通性问题)

    Pavel 喜欢网格迷宫.一个网格迷宫是一个 n × m 的长方形迷宫,其中每个单元格要么是空白的,要么是墙体.您可以从一个单元格走到另一个单元格,只要两个单元格均是空白的,且拥有一条公共的边. Pa ...

  8. History lives on in this distinguished Polish city 2017/1/4

    原文 History lives on in this distinguished Polish city Though it may be ancient. KraKow, Poland, is a ...

  9. SVM(支持向量机)的一点理解

    最近有被问到SVM的问题,不懂装懂,羞愧不已.百度有很多深入浅出介绍SVM的文章,我就不赘述了,这里写一点自己肤浅的理解. SVM的核心思想是把求解低维空间上的高维分类器转化为求解高维函数空间上的线性 ...

随机推荐

  1. Linux 下的另一个密码破解工具medusa

    首先,本人在此声明 此工具许合理利用非法破解很可能会被发现的因为这是一个暴力破解方式需要不断的尝试登陆服务器 ,服务器上的检测软件很快可以跟踪到并锁定你的IP地址 请大家切勿用于非法手段- -! me ...

  2. iOS多线程GCD(转)

    转自:http://www.cnblogs.com/pure/archive/2013/03/31/2977420.html Grand Central Dispatch (GCD)是Apple开发的 ...

  3. 一步一步教你将普通的wifi路由器变为智能广告路由器

    一步一步教你将普通的wifi路由器变为智能广告路由器 相信大家对WiFi智能广告路由器已经不再陌生了,现在很多公共WiFi上网,都需要登录并且验证,这也就是WiFi广告路由器的最重要的功能.大致就是下 ...

  4. POJ 2442 Sequence

    Pro. 1 给定k个有序表,取其中前n小的数字.组成一个新表,求该表? 算法: 由于  a1[1] < a1[2] < a1[3] ... <a1[n] a2[1] < a2 ...

  5. shell截取字符串

    image_tag="pangu-20151021102145\"" 1.用#号截取,符号-右面所有字符串 TMP=${image_tag#*-} echo $TMP 得 ...

  6. (源码)自己写的ScrollView里套漂亮的圆角listview(算是漂亮吧。。。)

    找了相关的资料终于写完了: http://blog.csdn.net/jamin0107/article/details/6973845 和 http://emmet1988.iteye.com/bl ...

  7. Linux 之 最常用的20条命令

    玩过Linux的人都会知道,Linux中的命令的确是非常多,但是玩过Linux的人也从来不会因为Linux的命令如此之多而烦恼,因为我们只需要掌握我们最常用的命令就可以了.当然你也可以在使用时去找一下 ...

  8. Calico在Kubernetes中的搭建

    一,需求 Kubernetes官方推荐的是Flannel,但是Flannel是一个overlay的网络,对性能会有一定的影响.Calico恰好能解决一下overlay网络的不足. Calico在Kub ...

  9. 2.前端笔记之css

    title: 1.前端笔记之CSS date: 2016-04-05 23:05:51 tags: 前端 categories: w3c --- 作者:刘耀 **出处:http://www.liuya ...

  10. [SVN(ubuntu)] ubuntu使用svn

    转载自:http://lee2013.iteye.com/blog/1058047 SVN作为日常开发中不可缺少的工具,Ubuntu下的SVN安装十分简单,sudo apt-get install s ...