PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000269. Tổng tích với ước chung lớn nhất (GCD Product Sum)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tổng tích với ước chung lớn nhất (GCD Product Sum)
GCD Product Sum
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , compute , where is the greatest common divisor.
Input
Read one integer .
Output
Print the exact integer without applying a modulus.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
4
Output
24
Explanation
For , the required sum is .
Example 2
Input
6
Output
63
Explanation
For , the required sum is .
Example 3
Input
7
Output
70
Explanation
For , the required sum is $1\cdot1+2\cdot1+3\cdot1+4\cdot1+5\cdot1+6\cdot1+7\cdot7=70$.
Example 4
Input
9
Output
135
Explanation
For , the required sum is $1\cdot1+2\cdot1+3\cdot3+4\cdot1+5\cdot1+6\cdot3+7\cdot1+8\cdot1+9\cdot9=135$.