PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CCBCHBA0000079. Tam giác sao tăng (Increasing 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 tăng (Increasing Star Triangle)
Increasing Star Triangle
Source: Phước Hưng OJ
Problem Statement
Given n, print n lines. The 1-based row i contains exactly i consecutive * characters and no spaces.
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 increase from 1 to 4.
Example 2
Input:
1
Output:
*
Explanation:
A single row contains one star.