Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Cycle of Numbers

By hafiz_samrat · Limits 1s, 32 MB

Consider the following function f defined for any natural number:

f(n) is the number obtained by summing up the squares of the digits in decimal (or base-ten).

If n = 19, for example, then f(19) = 82 because 1^2 + 9^2.

Repeatedly applying this function, some natural numbers eventually become 1. For example, 19 is a happy number, because repeatedly applying function ݂ to 19 results in:
f(19) = 1^2 + 9^2 = 82
f(82) = 8^2 + 2^2 = 68
f(68) = 6^2 + 8^2 = 100
f(100) = 1^2 + 0^2 + 0^2 = 1

However, not all natural numbers eventually become 1. You could try for 5, and you will see that 5 is not a become 1.
If it does not become 1 then, it has been proved by mathematicians that repeatedly applying function ݂ to ݊
reaches a continuous cycle:
2 → 4 → 16 → 37 → 58 → 89 → 145 → 42 → 20 → 4 → 16 → .....

When numbers become 1, do nothing and function f is useless for you.
A full cycle number is a number that has a cycle from that given number.

Write a program that decides if a given natural number ݊ is a cycle number or not. If not then, print “NO CYCLE”, If full-cycle number, then print “FULL CYCLE”, otherwise print “PARTIAL CYCLE”.

Input

The input consists of a single line that contains an integer, n (1 <= n <= 10^18)

Output

Print the desired output

Samples

InputOutput
19
NO CYCLE
InputOutput
2
PARTIAL CYCLE

    Discussion

    Statistics


    80% Solution Ratio

    SIR.24Earliest, 2w ago

    islamsadiaFastest, 0.0s

    SIR.24Lightest, 131 kB

    bappi2097Shortest, 406B

    Submit

    Login to submit