Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
45085 | wuxinyue | 分离整数的各个数 | C++ | 运行出错 | 0 MS | 84 KB | 514 | 2024-04-09 19:56:52 |
#include <bits/stdc++.h> using namespace std; int n,sum,a[100000005],i = 0; int main(){ cin >> n; int x = n; for(int x = n;x >= 10;x = x / 10){ a[i] = x % 10; //cout << "a[i] = "<< a[i] << endl; sum ++; //cout << "sum = "<< sum << endl; i ++; //cout << "i = "<< i << endl; } sum ++; //cout << "sum = "<< sum << endl; i ++; //cout << "i = "<< i << endl; a[i] = x; //cout << "a[i] = "<< a[i] << endl; for(int i = sum;i >= 0;i --){ cout << a[i] << " "; } return 0; }