PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000162. Đếm cặp có tích là số chính phương (Together Square)
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ó tích là số chính phương (Together Square)
Together Square
Source: AtCoder ABC254 D
Version: Phuoc Hung OJ Extended — one dataset per judge run.
Problem Statement
Given , count ordered pairs , , such that is a perfect square.
Input
One line containing the integer .
Output
Print the number of qualifying ordered pairs.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Example
Input
4
Output
6
Explanation
The six ordered pairs are . Swapped pairs count separately.