#include<bits/stdc++.h>

using namespace std;

int i = 2;

int main()
{
    int a;
    cin >> a;

    cout << a % 10 << " ";

    while(a >= pow(10,i - 1)){

        cout << (a % (int)pow(10,i) - a % (int)pow(10,i - 1)) / pow(10,i - 1) << " ";

        i++;
    }

    return 0;
}

3 comments

  • @ 2024-8-19 12:22:39

    我觉得挺好

    #include<iostream>
    #include<list>
    using namespace std;
    main(){
    	int n;
    	cin>>n;
    	list<int> a;
    	list<int>::iterator it;
    	while(n>0){
    		a.push_back(n%10);
    		n/=10;
    	}
    	for(list<int>::iterator it=a.begin();it!=a.end();it++){
    		cout<<*it<<" ";
    	}
    }
    ```
    `
    • @ 2024-8-18 18:15:19

      写的很好,初赛的题目还在远方等待着你,加油少年

      👍 1
      • @ 2024-8-18 16:53:33

        真的很弱智

        • @ 2024-8-18 16:57:25

          因为我完全可以写成

          #include<bits/stdc++.h>
          
          using namespace std;
          
          int i = 100;
          
          int main()
          {
              int a;
              cin >> a;
          
              cout << a % 10 << " ";
          
              while(a >= i / 10){
          
                  cout << (a % i - a % (i / 10)) / (i / 10) << " ";
          
                  i *= 10;
              }
          
              return 0;
          }
          
          
        • @ 2024-8-18 16:57:49

          但是写一堆函数超酷的好吗

      • 1

      Information

      ID
      123
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      2
      Tags
      # Submissions
      26
      Accepted
      21
      Uploaded By