BZOJ 4173
我能说我这道题是打表找规律么
并不会证明QAQ.
答案就是phi(n)*phi(n)*n*m
证明去膜拜PoPoQQQ
#pragma GCC optimize ("O3") #include <iostream> #include <cstring> #include <algorithm> #include <stdio.h> typedef long long ll; #define P 998244353ll ll n,m; template<typename _t> inline _t read(){ _t x=0,f=1; char ch=getchar(); for(;ch>'9'||ch<'0';ch=getchar())if(ch=='-')f=-f; for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+(ch^48); return x*f; } inline ll get_phi(ll x){ ll ans = 1; for(ll i = 2;i*i<=x;i++) if(x%i==0){ ans = ans * (i-1) % P; x/=i; while(x%i==0){ ans = ans * i % P; x/=i; } } if(x!=1)ans = ans * (x-1) % P; return ans; } int main(){ n=read<ll>();m=read<ll>(); ll Ans = (n % P) * (m % P) % P * (get_phi(n) % P) % P * (get_phi(m) % P) % P; printf("%lld\n",Ans); }