Problem A. Welcome(水题,快速模拟出答案,学习思维)

版权声明:本人大三在读,有错误烦请指正,共同进步- ( ゜- ゜)つロ 乾杯~点赞请按右上角,转载请标明出处: https://blog.csdn.net/hzyhfxt/article/details/83787846

Problem A. Welcome

Input file: Output file: Time limit: Memory limit:

stdin
stdout
1 second
128 megabytes

”How happy we are, To meet friends from afar!”

Welcome to Hunan University of Chinese Medicine!

Hope all of you can enjoy the competition ^ v ^

Now your task is to read an integer w and output the character painting of ”HNUCM”, there are w space(s) (space are represented by dot) between two letters. Please refer to the sample for the specific format.

Input

There are several test files and each contains one case. The input contains only 1 integer w (1 ≤ w ≤ 2018).

Output

The output has 5 lines, each line has 25+4w characters which only contains ’o’(lowercase letter ’o’) and ’.’(English period ’.’)

Example

stdin

stdout

1

o...o.o...o.o...o.ooooo.o...o
o...o.oo..o.o...o.o.....oo.oo
ooooo.o.o.o.o...o.o.....o.o.o
o...o.o..oo.o...o.o.....o...o
o...o.o...o.ooooo.ooooo.o...o

stdin

stdout

2

o...o..o...o..o...o..ooooo..o...o
o...o..oo..o..o...o..o......oo.oo
ooooo..o.o.o..o...o..o......o.o.o
o...o..o..oo..o...o..o......o...o
o...o..o...o..ooooo..ooooo..o...o

【题意】

HNUCM五个字母是不变的,通过输入的w改变中间的间隔的点数

【改进】

第一遍读题完,第一眼没看出来五行组合出来的是五个字母,我还以为是每一行的五个字符代表一个字母,读第二遍题目时才发现,看样例速度还是要加强;

在间隔处插入点,我刚开始想了个超级麻烦的办法,把每五个存起来,其实只要把全部的都存起来然后循环插入就好了,还好队友想的是对的;

【代码】

#include <stdio.h>
char a[5][100] = {
        "o   o.o   o.o   o.ooooo.o   o",
        "o   o.oo  o.o   o.o    .oo oo",
        "ooooo.o o o.o   o.o    .o o o",
        "o   o.o  oo.o   o.o    .o   o",
        "o   o.o   o.ooooo.ooooo.o   o"
};
int main()
{
    int w;
    scanf("%d",&w);
    for(int i = 0;i < 5;i++)
    {
        for(int j = 0 ; j < 29;j++)
        {
            if(a[i][j] == '.')
                for(int k = 0;k < w;k++)    putchar('.');
            else
                putchar(a[i][j] == ' ' ? '.':a[i][j]);
        }
        printf("\n");
    }
    
    return 0;
}

猜你喜欢

转载自blog.csdn.net/hzyhfxt/article/details/83787846