zoukankan      html  css  js  c++  java
  • HDU 4706:Children's Day

    Children's Day

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 1733    Accepted Submission(s): 1121


    Problem Description
    Today is Children's Day. Some children ask you to output a big letter 'N'. 'N' is constituted by two vertical linesand one diagonal. Each pixel of this letter is a character orderly. No tail blank is allowed.
    For example, this is a big 'N' start with 'a' and it's size is 3.
    a e
    bdf
    c g
    

    Your task is to write different 'N' from size 3 to size 10. The pixel character used is from 'a' to 'z' continuously and periodic('a' is reused after 'z').
     

    Input
    This problem has no input.
     

    Output
    Output different 'N' from size 3 to size 10. There is no blank line among output.
     

    Sample Output
    [pre] a e bdf c g h n i mo jl p k q ......... r j [/pre]
    Hint
    Not all the resultsare listed in the sample. There are just some lines. The ellipsis expresseswhat you should write.
     

    迷失在幽谷中的鸟儿,独自飞翔在这偌大的天地间,却不知自己该飞往何方……

    #include <iostream>
    #include <cmath>
    #include <stdio.h>
    #include <string>
    #include <cstring>
    #include <map>
    #include <set>
    #include <vector>
    #include <stack>
    #include <queue>
    #include <iomanip>
    #include <algorithm>
    using namespace std;
    char mp[20][20];
    char nextc(char c)
    {
        if(c=='z')return 'a';
        else return ++c;
    }
    int main()
    {
        char cur='a';
        int i,j,k;
        for(i=3; i<=10; i++)
        {
            memset(mp,' ',sizeof(mp));
            for(j=0; j<i; j++)
            {
                mp[j][0]=cur;
                cur=nextc(cur);
            }
            for(j=i-2,k=1; j>0; j--,k++)
            {
                mp[j][k]=cur;
                cur=nextc(cur);
            }
            for(j=0; j<i; j++)
            {
                mp[j][i-1]=cur;
                cur=nextc(cur);
            }
            for(j=0; j<i; j++)
            {
                for(k=0; k<i; k++)
                    printf("%c",mp[j][k]);
                printf("
    ");
            }
        }
        return 0;
    }
    


  • 相关阅读:
    .Net在arraylist用法
    ORM查询方法
    正则表达式大全
    checkbox修改功能保存功能绑定
    Web ASP.Net运行机制
    面试题
    Sql Server 中锁的概念
    由nginx和spring boot中tomcat配置不当引起的问题
    记录一次由事务可重复读引起的问题
    Ubuntu18.04没有声音的解决
  • 原文地址:https://www.cnblogs.com/im0qianqian/p/5989351.html
Copyright © 2011-2022 走看看