仰望高端玩家PoPoQQQ
4173: 数学
Time Limit: 10 Sec Memory Limit: 256 MB
Submit: 262 Solved: 144
[Submit][Status][Discuss]
Description
Input
输入文件的第一行输入两个正整数 。
Output
如题
Sample Input
5 6
Sample Output
240
HINT
N,M<=10^15
Source
PS:以下表示整除
自己编辑公式真难….感谢聪哥的指导
code:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
long long read()
{
long long x=0,f=1; char ch=getchar();
while (ch<'0' || ch>'9') {if (ch=='-') f=-1; ch=getchar();}
while (ch>='0' && ch<='9') {x=x*10+ch-'0'; ch=getchar();}
return x*f;
}
#define p 998244353
long long n,m;
long long phi(long long x)
{
long long y=(long long)sqrt(n+0.5);
long long re=x;
for(long long i=2; i<=y; i++)
if(!(x%i))
{
re=re/i*(i-1);
while(!(x%i)) x/=i;
}
if(x>1) re=re/x*(x-1);
return re;
}
int main()
{
n=read(),m=read();
long long ans;
ans=((((phi(n)%p)*(phi(m)%p))%p*(m%p))%p*(n%p))%p;
printf("%lld\n",ans);
return 0;
}