Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
168520 | 陈道宁 | 幂次方 | C++ | 解答错误 | 14 | 1 MS | 248 KB | 386 | 2024-08-20 11:18:21 |
#include<bits/stdc++.h> using namespace std; void dfs(int n){ while(n>0){ int temp=1,x=1; while(temp<=n){ x++; temp*=2; } x--; if(x==1){ cout<<"2(0)"; } else if(x==2){ cout<<"2"; } else{ cout<<"2("; dfs(temp/4); cout<<")"; } n-=temp/2; if(n!=0){ cout<<"+"; } } } int main(){ int n; cin>>n; dfs(n); }