ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

"蔚来杯"2022牛客暑期多校训练营6 G-Icon Design

2022-08-20 20:33:27  阅读:142  来源: 互联网

标签:.. 蔚来 ...... .... 多校 牛客 ............ size icon


问题描述

What's the feeling of designing an icon for a school as a programmer? Now you have a chance doing it!

The icon of Nanjing Foreign Language School (NFLS for short) is not complicated, it can be represented as an ASCII art.

 

Since the icon might be used in different places, you need to print the icon in different size.

Given size n, print the icon of size n.

Detailed format is shown below, you can also look at the sample output to confirm it.

 

Like which is shown in the picture, '*' is used on the boundary, and '@' is used for the letters.

(n+1) '.'s are used to seperate letters and the boundary horizontally, and n '.'s are used vertically.
Each letter is (2n+3) characters wide and (2n+3) characters in height.
The icon's size is (4n+5)×(13n+19).

输入格式

The first line contains a positive integer n(1≤n≤5), representing the size of the icon.

输出格式

Print the icon of size n.

样例1输入

1

样例1输出

********************************
*..............................*
*..@...@..@@@@@..@......@@@@@..*
*..@@..@..@......@......@......*
*..@.@.@..@@@@@..@......@@@@@..*
*..@..@@..@......@..........@..*
*..@...@..@......@@@@@..@@@@@..*
*..............................*
********************************

样例2输入

3

样例2输出

**********************************************************
*........................................................*
*........................................................*
*........................................................*
*....@.......@....@@@@@@@@@....@............@@@@@@@@@....*
*....@@......@....@............@............@............*
*....@.@.....@....@............@............@............*
*....@..@....@....@............@............@............*
*....@...@...@....@@@@@@@@@....@............@@@@@@@@@....*
*....@....@..@....@............@....................@....*
*....@.....@.@....@............@....................@....*
*....@......@@....@............@....................@....*
*....@.......@....@............@@@@@@@@@....@@@@@@@@@....*
*........................................................*
*........................................................*
*........................................................*
**********************************************************

题解

第一行是13n+19个“*”直接输出

接下来n行,每行除了第一个和最后一个是“*”,其它的都是“.”

接下来2n+3行是字母的输出,除了第一个和最后一个是“*”,每个字母两边都有n+1个“.”,每个字母占的宽度为2n+3,对于“N”,除了第一列和最后一列全是“@”,其它的只有当行数和列数相等时为“@”,对于“F”,第一列全是“@”,第1行和第n+2行是“@”,对于“L”,第一列和最后一行是“@”,对于“S”,第1,n+2,2n+3行都是“@”,以n+2为分界,n+2之前第一列是“@”,n+2之后最后一列是“@”

 

 

 1 #include <cstdio>
 2 int n;
 3 int main()
 4 {
 5     int i,j;
 6     scanf("%d",&n);
 7     for (i=1;i<=13*n+19;i++)
 8       printf("*");
 9     printf("\n");
10     for (i=1;i<=n;i++)
11     {
12         printf("*");
13         for (j=2;j<13*n+19;j++)
14           printf(".");
15         printf("*\n");
16     }
17     for (i=1;i<=2*n+3;i++)
18     {
19         printf("*");
20         for (j=1;j<=n+1;j++)
21           printf(".");
22         printf("@");
23         for (j=2;j<2*n+3;j++)
24         {
25             if (j==i) printf("@");
26             else printf(".");
27         }
28         printf("@");
29         for (j=1;j<=n+1;j++)
30           printf(".");
31         printf("@");
32         for (j=2;j<=2*n+3;j++)
33         {
34             if (i==1 || i==n+2) 
35               printf("@");
36             else printf(".");
37         }
38         for (j=1;j<=n+1;j++)
39           printf(".");
40         printf("@");
41         for (j=2;j<=2*n+3;j++)
42         {
43             if (i==2*n+3) printf("@");
44             else printf(".");
45         }
46         for (j=1;j<=n+1;j++)
47           printf(".");
48         for (j=1;j<=2*n+3;j++)
49         {
50             if (i==1 || i==n+2 || i==2*n+3)
51               printf("@");
52             else if (j==1 && i<n+2) 
53               printf("@");
54             else if (j==2*n+3 && i>n+2)
55               printf("@");
56             else printf("."); 
57         }
58         for (j=1;j<=n+1;j++)
59           printf(".");
60         printf("*\n");
61     }
62     for (i=1;i<=n;i++)
63     {
64         printf("*");
65         for (j=2;j<13*n+19;j++)
66           printf(".");
67         printf("*\n");
68     } 
69     for (i=1;i<=13*n+19;i++)
70       printf("*");
71     return 0;
72 } 

 

标签:..,蔚来,......,....,多校,牛客,............,size,icon
来源: https://www.cnblogs.com/rabbit1103/p/16608526.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有