G. Sphenic numbers
程序员文章站
2022-03-23 17:32:49
...
AC代码(唯一分解定理)
Select Code
#include <iostream>
#include <bits/stdc++.h>
#define maxn 0x3f3f3f3f
using namespace std;
long long sm = 0;
int k,s[20000];
void w(long long n)
{
k = 0;
for(int i = 2;i<=n;i++)
{
if(n%i==0)
{
while(n%i==0)
{
n/=i;
s[k++] = i;
}
}
}
}
int main()
{
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT","w",stdout);
cin>>sm;
w(sm);
if(k==3)
{
if(s[2]!=s[1]&&s[1]!=s[0])
{
printf("YES\n");
}
else
printf("NO\n");
}
else
printf("NO\n");
return 0;
}
上一篇: jQuery Ajax 异步访问
下一篇: poj Ugly Numbers