Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
170462 jipm6575lllzich 幂次方 C++ 通过 100 1 MS 272 KB 377 2024-08-20 20:56:47

Tests(7/7):


#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; }


测评信息: