P1010 [NOIP1998 普及组] 幂次方(传送门)
显示3WA2TLE,请大佬帮忙修改
#include <iostream>
#include <cmath>
using namespace std;
void binpow(int x){
for(int i=14;i>=0;i--){
if(pow(2,i)<=x){
if(!(i-1))cout<<'2';
else if(!i)cout<<"2(0)";
else{
cout<<"2(";
binpow(x-1);
cout<<')';
}
x-=pow(2,i);
if(x)cout<<'+';
}
}
return;
}
int main(){
int n;
cin>>n;
binpow(n);
return 0;
}