PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000087. Đếm cặp có BCNN bằng n (Pairs Forming LCM)
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ó BCNN bằng n (Pairs Forming LCM)
Pairs Forming LCM
Source: LightOJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , consider pairs with . Count those for which . The restriction ensures that each unordered pair is counted exactly once.
Input
One line containing .
Output
Print the number of valid pairs.
Subtasks
- Subtask 1 (20 points):
- Subtask 2 (30 points):
- Subtask 3 (50 points):
Examples
Input
12
Output
8
Explanation
The eight valid pairs are $(1,12),(2,12),(3,4),(3,12),(4,6),(4,12),(6,12),(12,12)$. All have LCM and satisfy .