10 solutions

  • 5
    @ 2023-10-4 10:12:34
    #include<bits/stdc++.h>
    using namespace std;
    long n;
    int main(){
    	cin>>n;
    	long s=n;
    	long x=0;
    	while(n){
    		x*=10;
    		x+=n%10;
    		n/=10;
    	}
    	if(s%10==0) cout<<0;
    	cout<<x;
    	return 0;
    }
    

    虽然题目说数据个位不为零,但是测试数据还是有的

    • 3
      @ 2023-11-18 15:57:04
      #include<bits/stdc++.h> 
      using namespace std;
      long long n;
      int f(long long x,long long &ans){//递归 
      	if(x==0) return ans/10;//除10是因为最后多一个0 
      	ans+=x%10;
      	ans*=10;
      	return f(x/10,ans);//继续从x/10开始 
      }//ans可以不取地址 
      int main(){
      	cin>>n;
      	long long ans=0;
      	long long s=f(n,ans);
      	if(n%10==0) cout<<0; 
      	cout<<s<<endl;
      	return 0;//不必多言 
      }
      

      想不到骚话了

      • 1
        @ 2023-12-24 10:50:00

        最快的解法

        #include <bits/stdc++.h>
        using namespace std;
        string a;
        int main(){
        	cin>>a;
        	int n=a.size();
        	while(n--) cout<<a[n];
        	return 0;
        }
        
        • 1
          @ 2023-11-15 13:11:55
          #include<iostream>
          using namespace std;
          void hdxs(int hn){
          	if(hn<10)cout<<hn;
          	else{
          		cout<<hn%10;
          		hdxs(hn/10);
          	}
          }
          int main(){
          	int hn;
          	cin
          	>>hn;
          	hdxs(hn);
          }
          
          • 1
            @ 2023-10-25 16:50:11

            直接黑化

            using namespace std;
            string a;
            int main(){
            	cin>>a;
            	int n=a.size();
            	while(n--) cout<<a[n];
            	return 0;
            }
            
            • 1
              @ 2023-10-10 19:57:20
              #include <bits/stdc++.h>
              using namespace std;
              int main(int argc, char **argv){
              	int n;
              	cin >> n;
              	while(n > 0){
              		cout << n % 10;
              		n /= 10;
              	}
              	return 0;
              }
              

              dstyg

              • 1
                @ 2023-10-4 10:53:58
                ```
                #include<bits/stdc++.h>
                using namespace std;
                long n;
                int main(){
                	cin>>n;
                	long s=n;
                	long x=0;
                	while(n){
                		x*=10;
                		x+=n%10;
                		n/=10;
                	}
                	if(s%10==0) cout<<0;
                	cout<<x;
                	return 0;
                }
                
                
                ```
                
                ```
                • 0
                  @ 2024-10-2 10:05:11

                  不要抄哦

                  #include<bits/stdc++.h>
                  using namespace std;
                  char n[114514];
                  int m[114514];
                  int main()
                  {
                  	int x = 1, num = 0;
                  	while(cin >> n[x])//输入 
                  	{
                  		m[x] = n[x] -'0';
                  		x++;
                  		num++;
                  	}	
                  	for(int i = num; i > 0; i--)
                  	{
                  		cout << m[i];
                  	}
                  
                  	
                  	return 0;
                  }
                  //#include<bits/stdc++.h>
                  //using namespace std;
                  //int n;
                  //int main()
                  //{
                  //	cin>>n;
                  //	int num=0;//计数 
                  //	while(n)//123 
                  //	{
                  //		num*=10;//进位 
                  //		num+=n%10;//123%10=3 //12%10=2 //1%10=1
                  //		n/=10;//123/10=12 //12/10=1 //1/10=0
                  //	}
                  //	int s=n%10;//123%10=3
                  //	if(s==0)//判断个位为0 
                  //	{
                  //		cout<<0;
                  //	}
                  //	cout<<num;
                  //	return 0;
                  //}
                  
                  
                  • -1
                    @ 2023-11-28 13:47:32
                    #include<iostream>
                    using namespace std;
                    void dxs(int n){
                    	if(n<10)cout<<n;
                    	else{
                    		cout<<n%10;
                    		dxs(n/10);
                    	}
                    }
                    int main(){
                    	int n;
                    	cin>>n;
                    	dxs(n);
                    }
                    
                    • -1
                      @ 2023-10-15 22:21:16

                      #include<bits/stdc++.h> using namespace std; int main(){ int a; scanf("%d",&a); for(int i=0;i<16;i++){ if(a>0){ cout<<a%10; a/=10; } else{ break; } } return 0; }

                      • 1

                      Information

                      ID
                      646
                      Time
                      1000ms
                      Memory
                      256MiB
                      Difficulty
                      5
                      Tags
                      # Submissions
                      116
                      Accepted
                      49
                      Uploaded By