Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
84010 sh25_shenpy Hanoi双塔问题 C++ 解答错误 0 MS 244 KB 437 2026-02-05 16:02:11

Tests(0/10):


#include <bits/stdc++.h> using namespace std; void jc(int &n) { int a[100]; memset(a,0,sizeof(a)); a[0] = 1; int m = 1; for(int j = 1; j <= n; j++) { int t = 0; for(int j = 0; j < m; j++) { t += a[j] * 2; a[j] = t % 10; t /= 10; } if(t > 0) a[m++] = 1; } for(int i = m-1; i >= 0; i--) { cout << a[i]; } cout<<'\n'; } int main(){ int n; while(cin>>n) jc(n); return 0; }


测评信息: