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

1≤n≤1001≤n≤100

1≤qi≤2∗1091≤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;
}

  

One Gym - 102680D的更多相关文章

  1. ACM: Gym 101047M Removing coins in Kem Kadrãn - 暴力

     Gym 101047M Removing coins in Kem Kadrãn Time Limit:2000MS     Memory Limit:65536KB     64bit IO Fo ...

  2. ACM: Gym 101047K Training with Phuket's larvae - 思维题

     Gym 101047K Training with Phuket's larvae Time Limit:2000MS     Memory Limit:65536KB     64bit IO F ...

  3. ACM: Gym 101047E Escape from Ayutthaya - BFS

    Gym 101047E Escape from Ayutthaya Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I6 ...

  4. ACM: Gym 101047B Renzo and the palindromic decoration - 手速题

     Gym 101047B  Renzo and the palindromic decoration Time Limit:2000MS     Memory Limit:65536KB     64 ...

  5. Gym 101102J---Divisible Numbers(反推技巧题)

    题目链接 http://codeforces.com/gym/101102/problem/J Description standard input/output You are given an a ...

  6. Gym 100917J---Judgement(01背包+bitset)

    题目链接 http://codeforces.com/gym/100917/problem/J Description standard input/outputStatements The jury ...

  7. Gym 100917J---dir -C(RMQ--ST)

    题目链接 http://codeforces.com/gym/100917/problem/D problem description Famous Berland coder and IT mana ...

  8. Gym 101102D---Rectangles(单调栈)

    题目链接 http://codeforces.com/gym/101102/problem/D problem  description Given an R×C grid with each cel ...

  9. Gym 101102C---Bored Judge(区间最大值)

    题目链接 http://codeforces.com/gym/101102/problem/C problem description Judge Bahosain was bored at ACM ...

  10. 2016"百度之星" - 初赛(Astar Round2A)Gym Class(拓扑排序)

    Gym Class  Accepts: 849  Submissions: 4247  Time Limit: 6000/1000 MS (Java/Others)  Memory Limit: 65 ...

随机推荐

  1. jdk8下载地址(附赠安装包)

    jdk下载地址:https://jdk.java.net/ (文末已经为大家下好了,放在网盘里) 进去后点8,win. 安装好后,使用java -version命令如下: 成功安装jdk! 为大家提供 ...

  2. WindowsPE文件格式入门05.PE加载器LoadPE

    https://bpsend.net/thread-316-1-1.html LoadPE - pe 加载器 壳的前身 如果想访问一个程序运行起来的内存,一种方法就是跨进程读写内存,但是跨进程读写内存 ...

  3. 2024Jiangxi_H Convolution

    Description Input Output Sample Input 5 5 3 3 0 -1 -1 0 0 0 1 -1 2 -2 2 -2 2 2 0 -1 0 0 -2 -1 0 -2 0 ...

  4. 《HelloGitHub》第 110 期

    兴趣是最好的老师,HelloGitHub 让你对开源感兴趣! 简介 HelloGitHub 分享 GitHub 上有趣.入门级的开源项目. github.com/521xueweihan/HelloG ...

  5. 超实用!手把手教你Dify版本升级

    很多情况下,我们需要升级 Dify 版本以获得新的功能和性能的提升,同时还能确保系统的安全性.稳定性和兼容性,从而更好地满足用户的需求. 那问题来了,怎么升级 Dify 版本呢? 接下来,我们以 Do ...

  6. 掌握ChangeSpeed类:让数学动画速度随心而动!

    在制作数学动画时,我们常常希望动画的速度能够根据需要进行调整,以更好地展示数学概念的演变过程. Manim框架中的ChangeSpeed类就是这样一个强大的工具,它能够帮助我们轻松地控制动画的速度变化 ...

  7. ChatClient vs ChatModel:开发者必须知道的4大区别!

    在 Spring AI/Spring AI Alibaba 框架中,ChatModel 和 ChatClient 都可以实现大模型的文本生成功能,例如聊天机器人,但二者是两种不同层级的 API 封装, ...

  8. 十、buildroot系统 桌面配置

    4.4.桌面控制 4.4.1.weston 文件夹路径 /common/overlays/10-weston 1.核心设置 配置 Weston 的核心设置 文件 /etc/xdg/weston/wes ...

  9. SQL Server 中的检查账号是否被锁定-用户登陆失败的原因与解决方案

    在使用 SQL Server 数据库时,用户可能会遇到"用户登陆失败"的问题.这种问题不仅会影响数据库的使用,也可能导致应用程序的中断.因此,了解这一问题的原因及其解决方案至关重要 ...

  10. JQ原生 Ajax请求

    现在的前端请求.真的是百花齐放,但是老古董ajax 还是挺好用的,主要是简单的 $.ajax({                    type: "Post",          ...