PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000022. Đếm cặp có phần dư đủ lớn (Remainder Reminder)
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 cặp có phần dư đủ lớn (Remainder Reminder)
Remainder Reminder
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
Given , count ordered pairs of positive integers with and . Reversing a pair produces a distinct ordered pair.
Input
One line containing .
Output
Print the number of valid ordered pairs.
Subtasks
- Subtask 1 (20 points): ;
- Subtask 2 (30 points): ;
- Subtask 3 (50 points): ;
Examples
Input
5 2
Output
7
Explanation
The seven qualifying pairs are .