oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

wonderland Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

wonderland.html

Alice got lost in the Wonderland shopping mall! The mall was so big, and she totally had no sense of direction. Luckily, she found a shopping directory! To locate the store that she was looking for, she had to key in the unit number of that store, N, into the searching bar.(N is an integer, 0 < N ≤ 20000) But the problem was that she was in Wonderland so everything must only be written in digits 0 and 2 with brackets. Although Alice did not have any sense of direction, she was very good at math! She found that every positive integer can be represented by he sum of the powers of 2. For example, 137 = 128+8+1 = 2^7+2^3+2^0. But clearly it was not enough because she still had 7, which was forbidden in the Wonderland. So she reduced it further: 7 = 2^2+2+2^0(note that 2^1 is represented by 2). Similarly, 3 = 2+2^0. In this way, she obtained an expression which only contained 2 and 0: 137 = 128+8+1 = 2^(2^2+2+2^0)+2^(2+2^0)+2^0. Since the symbol^ was also forbidden in the Wonderland, Alice had to represent a^b as a(b). So the final expression she should key in would be: 137 = 2(2(2)+2+2(0))+2(2+2(0))+2(0). She was too lazy to think so she called you up and asked you to write a program for her to output the "02" expression of the unit number of the store.

Input

Each input contains only one line, which contains the unit number of the store, N, 0 < N ≤ 20000.

Output

Each output contains only one line, which is the "02" expression of N.

Your output should contains only digits 0 and 2 and brackets.

Limits

Subtask 1 (11%): 0 < N ≤ 100

Subtask 2 (23%): 100 < N ≤ 5000

Subtask 3 (66%): 1000 < N ≤ 20000

Subtask 4 (0%): Sample testcases

Sample Input

137

Sample Output

2(2(2)+2+2(0))+2(2+2(0))+2(0)

Tags

Ad Hoc, Math

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
11151s32MBMinimum
22341s32MBMinimum
36651s32MBMinimum
4011s32MBMinimum

Judge Compile Command

g++-8 ans.cpp -o wonderland -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.