PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000185. Đếm dãy số nguyên liên tiếp (Staircase Sequences)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đếm dãy số nguyên liên tiếp (Staircase Sequences)
Staircase Sequences
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , count all nonempty sequences of consecutive integers with common difference whose sum equals . The first integer may be negative, zero or positive. Two sequences are different if they have different starting values or lengths.
Input
The input contains .
Output
Print the number of qualifying sequences.
Subtasks
-
Subtask 1 (20 points): .
-
Subtask 2 (30 points): .
-
Subtask 3 (50 points): .
Examples
Example 1
Input
12
Output
4
Explanation
The four sequences are , , , and the sequence from through .
Example 2
Input
1
Output
2
Explanation
The two valid sequences are and .
Example 3
Input
963761198400
Output
1920
Explanation
Twice the number of positive odd divisors of this input is .