Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Magic Trick

Limits 1s, 512 MB

Some times programming contest can be boring if you get stuck on a problem for a long period of time but don’t get AC. But you won’t get bored if you can witness a magic trick right now in the middle of the contest and an AC as a bonus.

To get an AC, you’ll have to follow a bunch of instructions. If you can follow the instructions properly, it is guaranteed that you’ll get an AC. The instructions are as follows.

  1. Think of any non-negative integer number.
  2. Subtract 1 from the number you have thought of.
  3. Multiply the number you have now by 3.
  4. Add 12 to the number.
  5. Divide the number by 3.
  6. Add 5 to the number.
  7. Subtract the original number you thought at first from the number you have now.
  8. Double the number you have now.
  9. Add 6 to the number.
  10. Divide that number by 2.
  11. Now subtract the number you had after executing step 7.
  12. Print the number you have now.

Input

There is no input for this problem.

Output

Just print the final answer you got.

Your solution will look something like this (in C):

#include <stdio.h>

int main() {
    int X = /*Put your answer here */;
    printf("%d\n", X);
    return 0;
}
Discussion