PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BS0000085. Xếp các hàng đồng xu (Arranging Coins)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Xếp các hàng đồng xu (Arranging Coins)
Arranging Coins
Source: LeetCode
Version: Phuoc Hung OJ Extended
Problem Statement
Given coins, row requires exactly coins. Determine how many initial rows can be completed; a final incomplete row does not count.
Input
A single line contains .
Output
Print the number of complete rows.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
8
Output
3
Explanation
Rows , , and consume coins. The remaining coins cannot complete row , so the answer is 3.