WILLITST - Will it ever stop
When Bob was in library in University of Warsaw he saw on one of facades caption :"Will it ever stop?" and below some mysterious code:
while n > 1 if n mod 2 = 0 then n:=n/2 else n:=3*n+3
Help him finding it out !
Input
In first line one number n<=10^14.
Output
Print "TAK" if program will stop, otherwise print "NIE"
Example
Input: 4 Output: TAK
hide comments
Bala Vignesh [Inactive]:
2015-03-03 10:20:57
very funny! |
|
:.Mohib.::
2015-03-01 13:45:16
lolzzz....!!! |
|
Priyansh Saxena:
2015-02-10 10:29:34
BITWISE does the trick in O(1). |
|
Richa Jain:
2014-08-19 15:27:53
changed long long to unsigned long long and got AC :) |
|
santhosh reddy:
2014-06-27 04:27:24
Nice problem!! |
|
VIVEK GARG:
2013-08-06 17:33:15
ha....easy problem......but shd use long long int. |
|
pika_pika:
2013-07-20 18:50:31
instead of using math functions use simple loop to avoid any floating point calculations as stated previously |
|
priyanghadevi:
2013-07-10 17:49:11
just a simple twist..:-)
|
|
orange:
2013-07-05 11:23:12
tricky input
|
|
orange:
2013-07-05 11:20:58
used loop >>ac
|
Added by: | Krzysztof Lewko |
Date: | 2011-11-09 |
Time limit: | 0.906s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | AMPPZ 2011 |