PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CCBCHBA0000073. Hình vuông đặc cạnh n (Solid Square of Stars)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Hình vuông đặc cạnh n (Solid Square of Stars)
Solid Square of Stars
Source: Phước Hưng OJ
Problem Statement
Given an integer n, print a square of exactly n rows and n columns. Every position contains *. Do not insert spaces between characters; print a newline after every row.
Input
One line containing exactly one integer n.
Output
Print exactly the required output described above. Do not print prompts, extra characters, or blank lines. For numerical rows, separate adjacent values with a single space and no trailing space.
Subtasks
- Subtask 1 (20%): 1 <= n <= 3.
- Subtask 2 (30%): 1 <= n <= 10.
- Subtask 3 (50%): 1 <= n <= 30.
Examples
Example 1
Input:
1
Output:
*
Explanation:
One row and one column produce one asterisk.
Example 2
Input:
3
Output:
***
***
***
Explanation:
There are three rows, each containing exactly three consecutive asterisks.