Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
|
||||||||||||||
2015-12-22 21:23:49
same algo in pyth 2.7 got AC but got RE in c++ |
||||||||||||||
2015-12-22 07:57:30
easy one.... |
||||||||||||||
2015-12-11 08:14:48 hmp
simply use vector....insert all changing n...check if n repeats or not |
||||||||||||||
2015-11-13 10:54:30 sri
ac with O(logn) |
||||||||||||||
2015-11-03 10:12:15 sumit suthar
nice one :) |
||||||||||||||
2015-10-29 11:47:11
hhh....I was unsure while submitting the solution: I was thinking that there is something hiding i didn't take care of....But I got the AC... this is the thing you must think ok: 3(n+1)=2^x which hasn't any solutions |
||||||||||||||
2015-10-19 21:16:45 munjal
I solved the problem but still unable to figure out what is wrong with http://ideone.com/455XS2 code !!!!! |
||||||||||||||
2015-10-18 12:40:44
Easy one.. only if-else.. AC in one go :) |
||||||||||||||
2015-10-09 09:56:26
Changing the type of input to long long int did the trick ! |
||||||||||||||
2015-08-31 20:34:04 sneh sajal
as i/p is large..search for direct formulas :) |