1. 程式人生 > >Problem A. Welcome(水題,快速模擬出答案,學習思維)

Problem A. Welcome(水題,快速模擬出答案,學習思維)

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;
}