#include <iostream>
#include <cmath>
using namespace std;
int n;
void pw(int x) {
if(!x) return;
if(x == 1) {
cout << "2(0)";
return;
}
if(x == 2) {
cout << "2";
return;
}
int i = 0;
while(pow(2, i + 1) <= x) i++;
int re = pow(2, i);
if(i > 1) {
cout << "2(";
pw(i);
cout << ")";
} else {
pw(re);
}
if(x - re) {
cout << "+";
pw(x - re);
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> n;
pw(n);
return 0;
}
2的幂次方
最新推荐文章于 2020-03-31 23:09:36 发布