From bcb6761f4d5eee3c998932fb71249f14c0477069 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sat, 1 Oct 2022 13:38:18 +0800 Subject: [PATCH] =?UTF-8?q?P2508=20[HAOI2008]=E5=9C=86=E4=B8=8A=E7=9A=84?= =?UTF-8?q?=E6=95=B4=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.luogu.com.cn/record/88070866 --- Luogu/P2508/P2508.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Luogu/P2508/P2508.cpp diff --git a/Luogu/P2508/P2508.cpp b/Luogu/P2508/P2508.cpp new file mode 100644 index 00000000..849ece35 --- /dev/null +++ b/Luogu/P2508/P2508.cpp @@ -0,0 +1,35 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + long long r, ans = 1; + + cin >> r; + + for (int i = 2; i * i <= r; i++) { + if (r % i == 0) { + int cnt = 0; + + while (r % i == 0) { + r /= i; + cnt++; + } + + if (i % 4 == 1) ans *= cnt * 2 + 1; + } + } + + if (r != 1 && r % 4 == 1) { + ans *= 3; + } + + cout << ans * 4 << endl; + + return 0; +}