Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
171973 | 欧阳雨泽 | 幂次方 | C++ | 解答错误 | 42 | 0 MS | 264 KB | 367 | 2024-08-20 21:02:28 |
#include<bits/stdc++.h> using namespace std; void g(long long x){ for(int i=14;i>=0;i--){ if(pow(2,i)<=x){ if(i==1)cout<<"2"; else if(i==0)cout<<"2(0)"; else{ cout<<"2("; g(i); cout<<")"; } x-=pow(2,i); if(x!=0)cout<<"+"; } } } int main(){ long long n;cin>>n; g(n); return 0; }