Sicily 14256. Pseudo Semiprime

Source: Internet
Author: User

Sicily 14256. Pseudo Semiprime

14256. Pseudo Semiprime Constraints

Time Limit: 1 secs, Memory Limit: 256 MB

Description

In number theory, a positive integer is a semiprime if it is the product of two primes. for example, 35 is a semiprime because 35 = 5*7, and both 5 and 7 are primes. A positive integer x is a pseudo do semiprime if there is two integers a and B such that a> 1, B> 1, a * B = x, and the greatest common divisor of a and B is 1.

Given an integer x, your task is to find out whether it is a pseudo do semiprime.

Input

The input begins with a line containing an integerT(T<= 100), which indicates the number of test cases. The followingTLines each contain an integerX(1 <=X<= 1000000000 ).

Output

For each case, output YES ifXIs a pseudo semiprime; otherwise output NO.

Sample Input
415810
Sample Output
NONONOYES
Problem Source

SYSUCPC 2014 Preliminary (Online) Round

 

#include 
 
  #include 
  
   int gcd(int a, int b) {int temp;while (b) {temp = a % b;a = b;b = temp;}return a;}int main() {int caseNum;scanf("%d", &caseNum);while (caseNum--) {bool isOK = false;int x;scanf("%d", &x);for (int i = 2; i * i <= x; i++) {if (x % i == 0) {if (gcd(i, x / i) == 1) {printf("YES\n");isOK = true;break;}}}if (!isOK) printf("NO\n");}return 0;}
  
 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.