AtCoder Beginner Contest 162
翻译中…
Problem Statement
翻译中…
Find $\displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}$.
翻译中…
Here $\gcd(a,b,c)$ denotes the greatest common divisor of $a$, $b$, and $c$.
翻译中…
Constraints
翻译中…
$1 \leq K \leq 200$$K$is an integer.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
K
翻译中…
Output
翻译中…
Print the value of $\displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}$.
翻译中…
样例
Input #1
2
Output #1
9
$\gcd(1,1,1)+\gcd(1,1,2)+\gcd(1,2,1)+\gcd(1,2,2)$ $+\gcd(2,1,1)+\gcd(2,1,2)+\gcd(2,2,1)+\gcd(2,2,2)$ $=1+1+1+1+1+1+1+2=9$
Thus, the answer is $9$.
Input #2
200
Output #2
10813692
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。