Marvelous Mazes UVA - 445

#include<iostream>
#include<stdio.h>
#include<string>
#include<cstring>
#define maxn 150
using namespace std;
char mapn[maxn][maxn];
int main()
{
    char str[150];
    while(gets(str)!=NULL)
    {
        int sum;
        for(int i=0;i<strlen(str);)
        {
            sum = 0;
            if(str[i] == ‘!‘)
                printf("\n");
            while(str[i]>=‘0‘&&str[i]<=‘9‘)//数字累加,11累加为2
            {
                sum += str[i] - ‘0‘;
                i++;
            }
            if(str[i] == ‘b‘)
                str[i] = ‘ ‘;
            for(int j=0;j<sum;j++)
                printf("%c",str[i]);
            i++;
        }
        printf("\n");
    }
    return 0;
}
时间: 2024-08-06 11:17:06

Marvelous Mazes UVA - 445的相关文章

Marvelous Mazes

F - Marvelous Mazes Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UVA 445 Description Your mission, if you decide to accept it, is to create a maze drawing program. A maze will consist of the alphabetic

UVa 445 - Marvelous Mazes

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem&problem=386 题目:给出一串包含A-Z,数字,*和空格的字符串,如果是!则输出换行,如果是b则输出空格,如果字符前有一个数字,则输出数字个字符,如果字符前有连续多个数字,则输出多个数字和的个数的字符. 思路:主要是注意多个连续数字的情况,将前面多个数字相加. 1 #i

UVa445 - Marvelous Mazes

题意:给出一个字符串,由数字.大写字母.*  .和b组成,当s[i]=='b'时,输出换行:当是数字时,如s[i]=2,s[i+1]='T',连续输出两个T:如果出现连续数字,则输出这些连续数字的和个字母,如11A,则输出AA. #include<stdio.h> #include<string.h> int main() { char s[140]; int i,j,sum,len; while(gets(s)!=NULL){ len=strlen(s); sum=0; for(

UVA_445:Marvelous Mazes

Language:C++ 4.8.2 #include<stdio.h> #include<string.h> #include<ctype.h> int main(void) { char str[140]; int sum; while(1) { if(fgets(str, sizeof(str), stdin) == NULL) break; if(str[0] == '\n') { printf("\n"); continue; } else

UVA题目分类

题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics 10300 - Ecological Premium 458 - The Decoder 494 - Kindergarten Counting Game 414 - Machined Surfaces 490 - Rotating Sentences 445 - Marvelous Mazes

寒假练习 01

这一系列的练习主要在Virtual Judge上进行,题目为小白书上的题目推荐. UVa 10055 注意两个数的大小关系,水题. #include <iostream> using namespace std; int main() { long long x, y; while(cin >> x >> y) { if(x > y) { swap(x, y); } cout << y - x << endl; } return 0; }

uva 784 Maze Exploration(DFS遍历图)

uva 784 Maze Exploration A maze(迷宫) of rectangular(矩形的) rooms is represented on a two dimensional(空间的) grid as illustrated(阐明) in figure 1a. Each point of the grid is represented by a character. The points of room walls are marked by the same charact

UVa 568 Just the Facts

A过去后看了一下别人的解法,发现除了打表还有一种数论的方法. 分析一下阶乘后面的0是怎么出现的呢,当然是2乘5得到的. 我们将1~N先放在一个数组里面. 从数组第一个元素开始,先统计一下N!中因子为5的个数记为count,将其除去,然后再除去count个2.这样一来的话把所有元素乘起来后就不会出现10的倍数了. 当然并不是真正的乘起来,那样的话肯定是要溢出的,因为只关心最后一位数,所以每次乘完后求10的余数即可. 我的做法是打表,因为题目里给了N <= 10000的条件限制,所以可以把1~100

win2003从组策略关闭端口(445/135/137/138/139/3389等)教程

一些恶劣的病毒会从某些端口入侵计算机,因此关闭某些用不到的而又具有高风险的端口就显得很有必要,是服务器管理员要做的基本的安全防范.本文将介绍win2003系统在组策略关闭某一个端口的教程,文章以关闭445端口为例. 首先要说明的是,此方法不仅仅适用于win2003,也适用于win7,且操作方法完全相同,所以win7用户也可以按照本文教程操作. 1.打开组策略编辑器 按组合键WIN+R打开运行窗口,然后输入gpedit.msc,按回车键,即可进入组策略编辑器. 2.创建 IP 安全策略 展开选项"