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.
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').
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]HintNot 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("\n");
        }
    }
    return 0;
}
    ------------------- 这是千千的个人网站哦! https://www.dreamwings.cn -------------------
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号