| ps | |
|---|---|
| 링크 | acmicpc.net/… |
| 출처 | BOJ |
| 문제 번호 | 3614 |
| 문제명 | 정사각형 |
| 레벨 | 골드 2 |
| 분류 |
정수론 |
| 시간복잡도 | O(n^(5/6)) |
| 인풋사이즈 | n<=10^6 |
| 사용한 언어 | Python 3.13 |
| 제출기록 | 34536KB / 36ms |
| 최고기록 | 36ms |
| 해결날짜 | 2026/01/25 |
"""Solution code for "BOJ 3614. 정사각형".
- Problem link: https://www.acmicpc.net/problem/3614
- Solution link: http://www.teferi.net/ps/problems/boj/3614
Tags: [number theory]
"""
from teflib import numtheory
def main():
N = int(input())
count = sum(
numtheory.euler_phi_small(g + 1)
for g in numtheory.all_divisors_small(N)
)
print((count + 1) // 2)
if __name__ == '__main__':
main()