hrubst 1328
来源:互联网 发布:被冷落的网络流行语 编辑:程序博客网 时间:2024/06/06 04:04
自己的数论好渣。。。。
如果N可以拆成两个互质数的乘积,那么结果就是YES
( 若 n = a*b , 如果 a,b不互质,那么gcd(a,b) > 1, lcm(a,b) = n/(gcd(a,b) < n)
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
using namespace std;
int gcd( int a, int b)
{
if( b == 0)
return a;
return gcd(b, a%b);
}
int main()
{
int n;
int t;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
bool ok = 0;
int i;
for( i = 2; i * i <= n; i++)
{
if(n%i == 0)
{
int res = n/i;
if(gcd(res, i) == 1)
{
ok = 1;
break;
}
}
}
if(ok)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
- hrubst 1328
- Hrubst---1082-----map方法
- Hrubst 1391 Orz odd【暴力打表找规律啊!】
- 1328
- 1328
- 1328
- POJ 1328
- poj 1328
- HUST 1328
- poj 1328
- POJ 1328
- poj 1328
- POJ 1328
- POJ 1328
- POJ--1328
- poj-1328
- POJ 1328
- POJ 1328
- Swift在IOS开发中的地位
- linux 下安装oracle12c
- Jquery 下的HashMap
- JS求一个字符串的长度
- 使用explain分析及优化由多表(三个以上)组成的视图性能
- hrubst 1328
- 第十一周项目1--3
- Android异步加载图像(含线程池,缓存方法)
- Jsp九大内置对象及四大作用域
- Swing shielding of components
- table 合并相同的列和行
- 第11周项目1000以内的回文素数
- Single Round Match 464 Round 1 - Division I, Level Two ColorfulDecoration
- ceph存储 安装win7+CentOS7双系统的方法