PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CCBCHBA0000077. Tam giác số bậc thang (Staircase Number 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 số bậc thang (Staircase Number Triangle)
Staircase Number Triangle
Source: Phước Hưng OJ
Problem Statement
Given n, print n rows. Row i consists of 1,2,...,i in increasing order, separated by single spaces with no trailing space.
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 <= 8.
- Subtask 3 (50%): 1 <= n <= 15.
Examples
Example 1
Input:
3
Output:
1
1 2
1 2 3
Explanation:
Row i lists 1 through i.
Example 2
Input:
1
Output:
1
Explanation:
The first row only contains 1.