提交时间:2024-04-09 19:56:52
运行 ID: 45085
#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; }