提交时间:2024-08-20 21:34:57

运行 ID: 173562

#include <iostream> #include <cstring> #define d64 long long using namespace std; // string solve(d64 n) { long long y=1; int x=0; while (y<=n) ++x,y<<=1; --x,y>>=1; string res=""; if (x==0) res+="2(0)"; else if (x==1) res+="2"; else res+="2("+solve(x)+")"; if (n-y>0) res+="+"+solve(n-y); return res; } // int main() { d64 n; scanf("%lld",&n); cout<<solve(n); return 0; }