4 条题解

  • 1
    @ 2025-7-17 10:47:41
    #include <bits/stdc++.h>
    #define LL long long
    using namespace std;
    const int N = 1e5 + 10;
    const int INF = 0x3f3f3f3f;
    int n , m;
    int main()
    {
    	    cin >> n;
            while (n)
            {
            	m = n % 10;
            	cout << m;
            	n /= 10;
    		}
    		return 0;
    }
    
    • 0
      @ 2025-4-8 17:10:04
      #include<bits/stdc++.h>
      using namespace std;
      int n;
      void f(int n){
      	if(!n)return;
      	cout<<n%10;
      	return f(n/=10); 
      }
      int main(){
      	cin>>n;
      	f(n);
      	return 0;
      }
      
      • 0
        @ 2024-9-2 20:13:31

        正解

        #include<bits/stdc++.h>
        using namespace std;
        const int N=1e5+10;
        int main(){
        	int a;
        	cin>>a;
        	int b=a/100;
        	int c=a/10;
        	int d=a%10;
        	//cout<<b<<c<<d;
        	cout<<c<<d;
        }
        

        然后,你错了,这才是正解

        #include <cmath>
        #include <cstdio>
        #include <cstdlib>
        #include <cstring>
        #include <iomanip>
        #include <iostream>
        using namespace std;
        int dg(int);
        int main()
        {
        	int n;
        	cin>>n;
        	dg(n);
        	return 0;
        }
        int dg(int i)
        {
        	int j,k;
        	j = i % 10;
        	k = i / 10;
        	cout<<j;
        	if (k != 0) dg(k);
        	return 0;
        }
        
        • -2
          @ 2025-2-10 18:58:58

          递归

          
          

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

          
          
          • 1

          信息

          ID
          3179
          时间
          1000ms
          内存
          256MiB
          难度
          5
          标签
          递交数
          148
          已通过
          61
          上传者