PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CCBCHBA0000080. Tam giác sao giảm (Decreasing Star Triangle)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tam giác sao giảm (Decreasing Star Triangle)
Decreasing Star Triangle
Source: Phước Hưng OJ
Problem Statement
Given n, print n rows. Row i contains n-i+1 consecutive * characters, starting with n stars and ending with one.
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:
4
Output:
****
***
**
*
Explanation:
The row lengths are 4,3,2,1.
Example 2
Input:
1
Output:
*
Explanation:
The single row contains one star.