标签:欧拉函数,数学,数论
Description
Input
输入文件的第一行输入两个正整数 。
Output
如题
Sample Input
5 6
Sample Output
240
HINT
N,M<=10^15
直接放PoPoQ大爷的式子
http://blog.csdn.net/popoqqq/article/details/46820313
code
#include<cstdio> #include<iostream> #include<cstring> #include<cstdlib> #include<cmath> #include<algorithm> #define rep(i,a,b) for(LL i=a;i<=b;i++) #define dep(i,a,b) for(LL i=a;i>=b;i--) #define LL long long #define mem(x,num) memset(x,num,sizeof x) using namespace std; const LL mod=998244353; LL n,m; LL phi(LL n) { LL t=n; rep(i,2,sqrt(n)) if(n%i==0){ t=t/i*(i-1); while(n%i==0)n/=i; } if(n!=1)t=t/n*(n-1); return t; } int main() { cin>>n>>m; cout<<(phi(n)%mod)*(phi(m)%mod)%mod*(n%mod)%mod*(m%mod)%mod<<endl; return 0; }