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的更多相关文章
- UVa 445 - Marvelous Mazes
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=s ...
- Marvelous Mazes UVA - 445
#include<iostream> #include<stdio.h> #include<string> #include<cstring> #def ...
- UVA_445:Marvelous Mazes
Language:C++ 4.8.2 #include<stdio.h> #include<string.h> #include<ctype.h> int main ...
- UVA题目分类
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...
- 【索引】Volume 0. Getting Started
AOAPC I: Beginning Algorithm Contests (Rujia Liu) Volume 0. Getting Started 10055 - Hashmat the Brav ...
- TOJ 2017: N-Credible Mazes
2017: N-Credible Mazes Time Limit(Common/Java):1000MS/10000MS Memory Limit:65536KByteTotal Subm ...
- CodeForce 377 A mazes(dfs+连通性问题)
Pavel 喜欢网格迷宫.一个网格迷宫是一个 n × m 的长方形迷宫,其中每个单元格要么是空白的,要么是墙体.您可以从一个单元格走到另一个单元格,只要两个单元格均是空白的,且拥有一条公共的边. Pa ...
- 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 ...
- SVM(支持向量机)的一点理解
最近有被问到SVM的问题,不懂装懂,羞愧不已.百度有很多深入浅出介绍SVM的文章,我就不赘述了,这里写一点自己肤浅的理解. SVM的核心思想是把求解低维空间上的高维分类器转化为求解高维函数空间上的线性 ...
随机推荐
- javascript仿天猫加入购物车动画效果
javascript仿天猫加入购物车动画效果 注意:首先需要声明的是:代码原思路不是我写的,是在网上找的这种效果,自己使用代码封装了下而已:代码中都有注释,我们最主要的是理解抛物线的思路及在工作中 ...
- Spring3中的mvc:interceptors标签配置拦截器
mvc:interceptors 这个标签用于注册一个自定义拦截器或者是WebRequestInterceptors. 可以通过定义URL来进行路径请求拦截,可以做到较为细粒度的拦截控制. 例如在配置 ...
- Android 将可以按地点自动启动应用程序
导读Android是一种基于Linux的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由Google公司和开放手机联盟领导及开发.尚未有统一中文名称,中国大陆地区较多人使用“安 ...
- 一张图说明该选用神马程式来serve你的django应用
- Redis系列-远程连接redis并给redis加锁
假设两台redis服务器,ip分别为:192.168.1.101和192.168.1.103,如何在101上通过redis-cli访问103上的redis呢?在远程连接103之前,先讲下redis-c ...
- Windows环境下的jekyll本地搭建
一.配置ruby环境 由于jekyll是用ruby语言写的一个静态网页生成工具,所以要搭建jekyll本地环境就需要先配置好ruby环境. 1)去官网下载Ruby:https://www.ruby-l ...
- mysql如何设置密码
1.用root 进入mysql后mysql>set password =password('你的密码');mysql>flush privileges;2.使用GRANT语句 mysql& ...
- spring3 + mybatis + maven:junit测试错误
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component c ...
- mysqldump备份
备份工具1.mysqldump(数据量很大时不推荐使用) myisam 锁表 innodb 行锁 mysqldump --help | less #查看mysql所有的语法 mysqldu ...
- 六间房 繁星 酷我 来疯 秀吧 新浪秀 直播播放器 Live 1.2
适合用于进行录制的时候 特别说明: 安装 falsh play 19 时 不能正常播放 每个按钮都有提示,不详细说明 下载地址 http://pan.baidu.com/s/1i32ETIt 下载地址 ...