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
kevinmitnick42:
2021-11-18 15:43:50
y'all wildin |
|
mohit_010:
2021-11-11 07:04:23
its easy, we need to check the power of two Last edit: 2021-11-18 15:57:36 |
|
mathuramol:
2021-07-10 09:27:45
AC in one go :) |
|
upsehu:
2021-05-30 13:10:04
make sure to put NIE not NE |
|
apurv22:
2021-05-27 10:04:42
cant get a more simpler problem on spoj |
|
yasser1110:
2021-02-24 09:49:34
simple but tricky question. |
|
marat0210:
2021-02-01 19:05:11
@sarveshjain967. Well I used 47 loops. Which is log2(10^14). That was enough for AC. |
|
anurag_mishra:
2020-11-27 18:56:20
__builtin_popcount = int
|
|
crawler_123:
2020-08-04 14:22:48
Don't use __builtin_popcount here. I repeat don't use it. |
|
imsrvstv:
2020-06-28 19:55:07
Btw I got 4 wrong answers because I was printing "NIL" instead of "NIE" keep in mind to not do that mistake too. Last edit: 2022-08-09 22:11:46 |
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 |