#include <iostream>
#include <vector>
using namespace std;
class Solution{
public:
vector<int> divideNum(int n){
int sum=0;
vector<int> res;
while(n/10>0) {
//div store ge shi bai...
int div = n % 10;
res.push_back(div);
//update n
n = n / 10;
}
if(n/10==0){
//0-9;
res.push_back(n);
}
return res;
}
};
int main(){
int n=12309;
vector<int> vec=Solution().divideNum(n);
for(int i=0;i<vec.size();i++){
cout<<vec[i]<<" ";
}
cout<<endl;
return 0;
}
网友评论