提交时间:2024-08-20 20:56:47

运行 ID: 170462

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