1. 程式人生 > >2018湖南省第14屆大學生計算機程序設計競賽 A字符畫

2018湖南省第14屆大學生計算機程序設計競賽 A字符畫

計算 NPU esc str 設計 c++ pla else i++

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 **********************************************************************/

2018湖南省第14屆大學生計算機程序設計競賽 A字符畫