One Gym - 102680D

https://vjudge.net/problem/Gym-102680D/origin

https://vjudge.net/contest/396206#problem/D

Hooray! It's time for the obligatory problem concerning the random mathematical properties of an arbitrary number! And since today is the 1st Brookfield Computer Programming Challenge, this year's number is 1!

One is a pretty unique number. Of course, it is the multiplicative identity (that is x*1 = x), as well as the smallest natural number. It is sometimes called the loneliest number, the maximum value of Random.nextDouble(), the magnitude of any unit vector, and the only positive number that is a valid digit in any base, as well as power of 2 itself (20=120=1, oh joy!). It is also both the second and third Fibonacci number (0, 1, 1, 2, 3, 5, 8...). In fact, it is the only number to appear a prime number of times in the Fibonacci sequence.

Speaking of primes, whether or not 1 is a prime number has been discussed quite fervently among mathematicians. A prime is a number with exactly two unique natural factors. A composite number is a number with more than two unique natural factors. 7, for example, has factors of 1 and 7, but no others, making it prime. 9 has factors of 1, 3, and 9, making it composite. 1, however, is only divisible by 1, and is therefore neither prime nor composite. Interestingly, 1 is the only number with this property.

Given nn natural numbers, decide whether each of them is prime, composite, or neither. Be careful that your program finishes execution within 5 seconds for any valid input.

Input

The first line will contain an integer nn, the number of natural numbers to compute. nn lines follow, each containing a single integer qiqi

1n1001≤n≤100

1qi21091≤qi≤2∗109

Output

Output nn lines, each containing either "Prime", "Composite", or "Neither", depending on the state of each number.

Example

Input
4
9
1
2017
1000000007

Output
Composite
Neither
Prime
Prime

Note

9 has 3 factors: 1,3, and 9, and is therefore composite.

1 is discussed in the problem statement.

2017 only has factors of 1 and itself, and is therefore prime.

1000000007 also happens to be prime for the same reason.

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include <vector>
#include <iterator>
#include <utility>
#include <sstream>
#include <limits>
#include <numeric>
#include <functional>
using namespace std;
#define gc getchar()
#define mem(a) memset(a,0,sizeof(a))
#define debug(x) cout<<"debug:"<<#x<<" = "<<x<<endl;

#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef char ch;
typedef double db;

const double PI=acos(-1.0);
const double eps=1e-6;
const int inf=0x3f3f3f3f;
//const int maxn=1e5+10;
const int maxn = 5010;
//const int maxm=100+10;
const int N=1e6+10;
const int mod=1e9+7;


bool isPrime(int Check)
{
	int min = Check < sqrt(Check)+1 ? Check : sqrt(Check)+1;
 	for(int i = 2;i<min;i++)
	{
		if(Check % i == 0)
		{
			return 0;
		}
	}
	return 1;
}

int main()
{
	int T = 0;
	cin >> T;
	while(T--)
	{
		int Check;
		cin >> Check;
		if(Check == 1)
		{
			cout << "Neither" << endl;
			continue;
		}
		if( isPrime(Check) )
		{
			cout << "Prime" << endl;
		}
		else
		{
			cout << "Composite" << endl;
		}
	}
	return 0;
} 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

YukiRinLL

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值