PSYCHON - Psycho

Given an integer N, the number N is called “Psycho Number”. Psycho Number is calculated as follows:

First, If we factorize N , then we have some prime and their power. Assume that, there are M powers. From M powers , you should count the number of even and odd powers. Then if the number of even power is strictly greater than odd power, then we call the number N is “Psycho Number”, otherwise the number N is call “Ordinary Number”.

As for example, if N = 67500 then prime factorization, 

67500 = 22 x 33 x 54

Count even powers and odd powers . This number have 2 even power(2, 4) and 1 odd power (3). Since even power 2 (2, 4) is greater than odd power 1 (3), so the number 67500 is a Psycho Number.

Input:

An integer T (1 <= T <= 106) denoting the number of test cases followed by T lines. Each containing a single integer N (1 <= N <= 107).

Output:

For each case print  “Psycho Number” or “Ordinary Number”.

Sample

Sample Input
2
3
4

Sample Output
Ordinary Number
Psycho Number
Note: 0 and 1 are not a psycho number.
Psycho 2: Psycho Function Psycho 3: Make Psycho Psycho 4: Psycho34 (easy)

Problem setter: Shipu Ahamed, Dept. of CSE, Bangladesh University of Business and Technology (BUBT)

[ Edited by EB ] Warning: Some input files are broken.


Added by:Shipu Ahamed
Date:2013-09-18
Time limit:0.5s
Source limit:6000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2022-12-16 22:10:37
use fastio to avoid TLE :)

Last edit: 2022-12-16 22:11:19
2022-11-22 15:32:54
i have a question...
for(int i=0; PRIME[i]*PRIME[i]<=n && i<PRIME.size(); i++)

i just run this loop for every test case and find the prime factorize and then print the ouput...i got ac...But so many people use this approch and got ac..

but what if all the test case have a large prime number like 9999991
then my time complexity would become (number of test case*number of prime lower then sqrt(9999991))
if i am not wrong time complexity becomes>=9*10^8 ... so in this worst case this approch will get tle....so i think problem setter need to add this test case...and then update the complexity/other constrain if need


Last edit: 2022-11-22 15:35:12
2020-05-08 06:49:16
I found myself debugging this problem for 3 hours because I was reading (as I usually do) like this:
cin >> n;
while (cin >> n)
Be careful if you do this on this problem, the input is stupid and will make you get WA.

Last edit: 2020-05-08 06:49:44
2018-02-02 20:34:04
Nice Problem :-)
2017-07-21 19:15:30
cin/cout gives tle... use scanf,printf
2017-03-03 15:14:26
any ideas on how to solve this question ??
2016-10-03 13:16:58
Nice Question !!!


Last edit: 2016-10-03 13:17:17
2015-07-31 21:44:55
why am i receiving a SIGSEGV error....:(
2015-06-26 23:25:20 :.Mohib.:
Really nice que!!
2015-06-20 17:46:30 Ayur Jain
Don't use fast I/O. It's giving TLE.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.