-->
当前位置:首页 > 题库 > 正文内容

编程题:Draw a square with Obama

Luz2年前 (2022-11-21)题库331
President Obama not only called on everyone to learn to program, but even set an example to write code, becoming the first president in American history to write computer code. At the end of 2014, to celebrate the official launch of "Computer Science Education Week", Obama wrote a very simple computer code: draw a square on the screen. Now you can draw with him!

### Input Specification:
Enter the integer n and the character c in a line with a space between them. n(3 ≤ n ≤ 21) represents the side length of the square, and c is the character that forms the square.
### Output Specification:
Output the square formed by the given character c. However, note that the row spacing is larger than the column spacing, so in order to make the result look more like a square, the number of rows we output is actually 50% of the number of columns (rounded).
### Sample Input #1:
in
10 a

### Sample Output #1:
out
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa
aaaaaaaaaa

### Sample Input #2:
in
7 *

### Sample Output #2:
out
*******
*******
*******
*******











答案:若无答案欢迎评论

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。