现在的位置: 首页 > 综合 > 正文

uvaoj 445 – Marvelous Mazes

2014年09月05日 ⁄ 综合 ⁄ 共 383字 ⁄ 字号 评论关闭
#define LOCAL
#include<stdio.h>
#include<string.h>
int main()
{
#ifdef LOCAL
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
#endif
    
    
    char c;
    int t=0;
    while((c=getchar())!=EOF)       //这个条件很巧妙哟。。。 
    {
           if(c=='b')
           {   while(t--) putchar(' ');t++;}        //原来t--跳出之后t成了-1,哎,下次注意!  
           else if(c=='!')
                  putchar('\n');
           else if(c=='\n')
               putchar(c);
           else if(isdigit(c))
           {
                  t+=c-'0';
           }
           else if(t)
           {
                   {while(t--) putchar(c);t++;}     
           }
    }
    return 0;
}

抱歉!评论已关闭.