1 条题解

  • 0
    @ 2023-6-11 12:20:40

    C :

    #include<stdio.h>
    int main()
    {
        int m,n,t,s;
        scanf("%d",&m);
        n=m/10;
        t=m%10;
        s=t*10+n;
        if(s>m)
            printf("%d",s);
        else
            printf("%d",m);
        return 0;
    }
    
    

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    
    int main(){
        int n;
        cin>>n;
        int x = n % 10 * 10 + n / 10;
        if(n > x){
        	cout<<n;
    	}else{
    		cout<<x;
    	}
    }
     
    
    

    Java :

    import java.util.Scanner;
    
    public class Main {
    
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		Scanner sc = new Scanner(System.in);
    		int a = sc.nextInt();
    		int g = a % 10;
    		int s = a / 10;
    		int b = g * 10 + s;
    		if(a > b){
    			System.out.println(a);
    		}if(a < b){
    			System.out.println(b);
    		}
    	}
    
    }
    
    

    Python :

    n = int(input())
    s = n // 10 % 10
    g = n // 1 % 10
    b = g * 10 + s
    if b > n:
        print(b)
    else:
        print(n)
    
    • 1

    信息

    ID
    2535
    时间
    1000ms
    内存
    64MiB
    难度
    10
    标签
    递交数
    5
    已通过
    1
    上传者