From 08a11da9c6b9fdecb5ef72b3290213796d45e141 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Sat, 10 Jul 2021 16:24:55 +0800 Subject: [PATCH] =?UTF-8?q?#473.=20=E7=AE=80=E5=8D=95=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E5=AD=A6=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sjzezoj.com/submission/13575 --- S2OJ/473/473.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 S2OJ/473/473.cpp diff --git a/S2OJ/473/473.cpp b/S2OJ/473/473.cpp new file mode 100644 index 00000000..716c6e56 --- /dev/null +++ b/S2OJ/473/473.cpp @@ -0,0 +1,24 @@ +#include + +using namespace std; + +const int mod = 998244353; + +long long n, m; + +long long phi(long long x) { + long long ans = x; + for (long long i = 2; i * i <= x; i++) + if (x % i == 0) { + ans = ans / i * (i - 1); + while (x % i == 0) x /= i; + } + if (n > 1) ans = ans / x * (x - 1); + return ans; +} + +int main() { + scanf("%lld%lld", &n, &m); + printf("%lld\n", (long long)(n % mod) * (m % mod) % mod * (phi(n) % mod) % mod * (phi(m) % mod) % mod); + return 0; +} \ No newline at end of file