zoukankan      html  css  js  c++  java
  • 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("
    ");
        }
        return 0;
    }
    
    /**********************************************************************
        Problem: 1358
        User: HNCPCteam001
        Language: C++
        Result: AC
        Time:0 ms
        Memory:2024 kb
    **********************************************************************/
  • 相关阅读:
    LA3971组装电脑
    LA3971组装电脑
    LA3905流星
    LA3905流星
    LA3902网络
    LA3902网络
    LA3708墓地雕塑
    洛谷 P2330 [SCOI2005]繁忙的都市(最小生成树)
    最小生成树 & 洛谷P3366【模板】最小生成树 & 洛谷P2820 局域网
    洛谷 P1372 又是毕业季I
  • 原文地址:https://www.cnblogs.com/jkzr/p/9589255.html
Copyright © 2011-2022 走看看