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
orange: 2013-07-05 11:17:49

@ Erti-Chris Eelmaa yes!! there is formula for this.

..........: 2013-07-04 04:40:15

Got AC at first attempt..:)

fdfdfwgwg: 2013-07-02 13:39:23

mine shows nzec after 20 cases- http://ideone.com/sKblYc

any suggestions?

Last edit: 2013-07-02 13:41:14
ganpya: 2013-06-29 20:09:39

this is the case of repetition..use map and plz use unsigned long long...long long wont work

Got AC

Last edit: 2013-06-29 20:10:03
« sudipto »: 2013-06-21 21:55:07

lolzz.. got wa coz of printing NEI in place of NIE... AC;)

Vipul Pandey: 2013-06-21 18:56:15

long long int will work, no need of unsigned long long.

Prikshit Kumar: 2013-06-12 06:47:40

Easy Problem.
Got AC at first attempt..:)

Erti-Chris Eelmaa: 2013-06-03 08:03:14

3 minutes, really easy exercise. though I believe there should be formula that can do this without loop?

Rishabh Dugar: 2013-05-21 14:15:19

ac at first try!!

Noob: 2013-05-17 12:27:08

long long worked for me C/C++


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