2018湖南省第14届大学生计算机程序设计竞赛 A字符画

Description

读入 w,请输出 2018 的字符画,两个数字之间有 w 个空格。具体格式请参考样例输出。

  • 1 ≤ w ≤ 2018

Input

输入文件只包含 1 个整数 w.

Output

输出 5 行,每行 12 + 3w 个字符(只包含 o 和 . 两种,字符画的部分用 o,空格的部分用 .),以换行符结尾。

Sample Input

2

Sample Output

ooo..ooo..ooo..ooo
..o..o.o...o...o.o
ooo..o.o...o...ooo
o....o.o...o...o.o
ooo..ooo..ooo..ooo

解释:这是一道水题,就是模拟,2018这个字符不变变化的只有中间的那个.的个数,所以直接写就行
#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <deque>
#include <list>
using namespace std;
typedef long long LL;
const int INF=0x3f3f3f3f;
const double eps=1e-8;
const double pi=acos(-1.0);
const int MOD=10056;
const int maxn=2016;
int w;

int main()
{
    scanf("%d",&w);
    for(int i=1;i<=5;i++)
    {
        if(i==1)
        {
            printf("ooo");
            for(int j=1;j<=w;j++)
                printf(".");
            printf("ooo");
            for(int j=1;j<=w;j++)
                printf(".");
            printf("ooo");
            for(int j=1;j<=w;j++)
                printf(".");
            printf("ooo");
        }
        else if(i==2)
        {
            printf("..o");
            for(int j=1;j<=w;j++)
                printf(".");
            printf("o.o");
            for(int j=1;j<=w;j++)
                printf(".");
            printf(".o.");
            for(int j=1;j<=w;j++)
                printf(".");
            printf("o.o");
        }
        else if(i==3)
        {
            printf("ooo");
            for(int j=1;j<=w;j++)
                printf(".");
            printf("o.o");
            for(int j=1;j<=w;j++)
                printf(".");
            printf(".o.");
            for(int j=1;j<=w;j++)
                printf(".");
            printf("ooo");
        }
        else if(i==4)
        {
            printf("o..");
            for(int j=1;j<=w;j++)
                printf(".");
            printf("o.o");
            for(int j=1;j<=w;j++)
                printf(".");
            printf(".o.");
            for(int j=1;j<=w;j++)
                printf(".");
            printf("o.o");
        }
        else
        {
            printf("ooo");
            for(int j=1;j<=w;j++)
                printf(".");
            printf("ooo");
            for(int j=1;j<=w;j++)
                printf(".");
            printf("ooo");
            for(int j=1;j<=w;j++)
                printf(".");
            printf("ooo");
        }
        printf("\n");
    }
    return 0;
}

/**********************************************************************
    Problem: 1358
    User: HNCPCteam001
    Language: C++
    Result: AC
    Time:0 ms
    Memory:2024 kb
**********************************************************************/

猜你喜欢

转载自www.cnblogs.com/jkzr/p/9589255.html
今日推荐