zoukankan      html  css  js  c++  java
  • hdu4706

    Children's Day

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


    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.
     
    Source
     
     
    #include<iostream>
    #include<stdio.h>
    using namespace std;
    int main()
    {
        int cnt = 0,k;
        char str[100][100];
        for(int i = 3; i <= 10; i++)
        {
            for(int j = 0; j < i; j++)
            {
                for(k = 0; k < i; k++)
                    str[j][k] = ' ';
            }
            for(int j = 0; j < i; j++)
            {
                str[j][0] = 'a' + cnt;
                cnt = (cnt+1)%26;
            }
            for(int j = i-2,k=1; j > 0; j--,k++)
            {
                str[j][k] = 'a' + cnt;
                cnt = (cnt+1)%26;
            }
            for(int j = 0; j < i; j++)
            {
                str[j][i-1] = 'a' + cnt;
                cnt = (cnt+1)%26;
            }
            for(int j = 0; j < i; j++)
                printf("%s
    ",str[j]);
        }
    
        return 0;
    }
  • 相关阅读:
    如何理解Linux中的load averages?
    如何准备Java初级和高级的技术面试
    大数据java基础吗?
    如何写出没有BUG的代码
    求强连通分量Tarjan算法
    图论_连通_连通分量
    欧拉函数
    二分图,匈牙利算法
    网络流24题(更新中
    一些简单二分题,简单的hash,H(i),字符串题
  • 原文地址:https://www.cnblogs.com/lxm940130740/p/3312885.html
Copyright © 2011-2022 走看看