提交时间:2024-08-20 19:30:33

运行 ID: 169881

#include <bits/stdc++.h> using namespace std; int n; void lcm(int n){ bool f = 0; while(n > 0){ int t = int(log2(n)); if(f){ cout << '+'; } if(t == 0){ cout << "2(0)"; } else if(t == 1){ cout << '2'; } else{ cout << "2("; lcm(t); cout << ')'; } f = 1; n -= pow(2,t); } } int main(){ cin >> n; lcm(n); return 0; }