C. 2的幂次方表示

    Type: Default 1000ms 256MiB

2的幂次方表示

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

【题目描述】

任何一个正整数都可以用2的幂次方表示。例如:

137=27^7+23^3+20^0

同时约定方次用括号来表示,即ab可表示为a(b)。由此可知,137可表示为:

2(7)+2(3)+2(0)

进一步:7=22^2+2+20^0(21^1用2表示)

3=2+20^0

所以最后137可表示为:

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

又如:

1315=210^10+28^8+25^5+2+1

所以1315最后可表示为:

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

【输入格式】

一个正整数n(n≤20000)。

【输出格式】

一行,符合约定的n的0,2表示(在表示中不能有空格)。

【样例数据】

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

算法系列之递归

Not Claimed
Status
Done
Problem
8
Open Since
2025-11-29 0:00
Deadline
2025-12-13 23:59
Extension
24 hour(s)