2 条题解

  • 1
    @ 2021-11-14 12:17:34
    #include<iostream> 
    using namespace std; 
    long long n,i = 1,ans = 0;
    int main(){
    	cin >> n;
        while(n){
            if(n % 10 != 0){
                ans += n % 10 * i;
                i *= 10;
            }
            n /= 10;
        }
        cout << ans;
        return 0;
    }
    
    • 0
      @ 2025-2-11 12:27:02

      递归

      #include<bits/stdc++.h> 
      using namespace std;
      const int N=1e2+5,INF=0x3f3f3f3f;
      long long n;
      void f(long long n){
      	if(n==0)return;
      	f(n/10);
      	if(n%10!=0)cout<<n%10;
      }
      int main()
      {
      	cin>>n;
      	f(n);
      	return 0;
      }
      
      • 1

      信息

      ID
      1422
      时间
      1000ms
      内存
      128MiB
      难度
      8
      标签
      递交数
      18
      已通过
      7
      上传者