Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define test int t; cin>>t; while (t--)
- #define ll long long int
- #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
- #define maX 1000008
- vector<ll>p;
- bool marked[maX];
- void sieve()
- {
- p.push_back(2);
- for(ll i=4;i<=maX;i+=2)
- {
- marked[i]=1;
- }
- for(ll i=3;i<=maX;i+=2)
- {
- if(marked[i]==0)
- {
- p.push_back(i);
- for(ll j=i*i; j<=maX; j+=i+i)
- {
- marked[j]=1;
- }
- }
- }
- }
- int main()
- {
- fellow_junior
- sieve();
- test
- {
- ll a,c,d=0,e=0,f,i,j,k,l;
- cin>>a;
- for(i=0;i<p.size() && p[i]*p[i]<=a;i++)
- {
- if(a%p[i]==0)
- {
- c=0;
- while(a%p[i]==0)
- {
- c++;
- a/=p[i];
- }
- if(c%2) d++;
- else e++;
- }
- }
- if(a>1) d++;
- if(e>d) cout<<"Psycho Number"<<endl;
- else cout<<"Ordinary Number"<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment