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

Help him finding it out !


In first line one number n<=10^14.


Print "TAK" if program will stop, otherwise print "NIE"




hide comments
eddie_codes: 2018-03-14 07:44:30

Instead of maps and bruteforce it's fun to think of what's actually happening in the function itself...........try to generate a math formula such that,as soon as you substitute 'n' in your formula you should get the output....in other words try for a single liner...

Last edit: 2018-03-14 07:45:51
ayusofayush: 2018-02-15 12:37:33

AC in one go ;) just check for 1-10 cases and see the pattern if 3,6,12 occurs make the loop infinite
or use bits manipulation

quock: 2018-02-06 04:47:16

Look tutorial of bit manipulation.

true_idiot: 2018-01-02 16:37:05

Weak test case :(
doesn't check when n=0.

akhand_mishra: 2018-01-02 13:22:54

use unsigned long long.
3 WA for that.
look for the pattern

sophozaar: 2017-12-14 11:16:47

":=" is "=". The colon is the misprint I guess.

metahost: 2017-11-06 06:01:36

long long costed WA!

frozen7: 2017-10-18 13:18:54

if(n<=1) then stops
if(n>1) check if n is a power of two if yes then stops otherwise does not stops

kush_pathak01: 2017-10-11 12:10:25

what's meaning of "n:="

themast3r: 2017-10-08 08:23:03

AC in one go ;) . Just 2 lines of code in Python :D!

Added by:Krzysztof Lewko
Time limit:0.906s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:AMPPZ 2011