1 条题解

  • 0
    @ 2026-2-10 15:53:02

    C :

    #include<stdio.h>
    int main()
    {
    	int a;
    	int b;
    	scanf("%d %d",&a,&b);
    	if(a>b)
    	{
    		printf("%d\n",a);
    	}
    	else
    	{
    		printf("%d\n",b);
    	}
    }
    

    C++ :

    #include <iostream>
    #include <math.h>
     using namespace std;
     int  main()
     {
        int a,b;
        cin>>a>>b;
        if(a-b<0)
        {
        	cout<<b<<endl;
    	}
        else
        {
        	cout<<a<<endl;
    	}
    	  return 0;
     }                                            
    

    Java :

    import java.util.Scanner;
    public class Main {
        public static void main(String[] args) {
            Scanner input = new Scanner(System.in);
            int a=input.nextInt(),b=input.nextInt();
            System.out.println(Math.max(a,b));
        }
    }
    
    

    Python :

    # coding=utf-8
    #!/usr/bin/python2
    import sys
    import re
    import math
    a,b=(int(x) for x in raw_input().split(' '))
    
    if a>b:
        print a
    else:
        print b
    
    

    C# :

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Security.Cryptography;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace ConsoleApp2
    {
        internal class Program
        {
            static void Main()
            {
                //int[] days = { 31,28,31,30,31,30,31,31,30,31,30,31};
                /*int n = Convert.ToInt32 (Console.ReadLine());
                string[] a1 = Console.ReadLine().Split();
                double r = Convert.ToDouble(a1[0]);
                double b = Convert.ToDouble(a1[1]);
                double c = Convert.ToDouble(a1[2]);
                float pi = 3.1415926f;
                string S = ((r + b+c) / n).ToString("0.00");
                */
                string[] n = Console.ReadLine().Split(' ');
                int a = Convert.ToInt16(n[0]); int b = Convert.ToInt16(n[1]); //int c = Convert.ToInt16(n[2]);
                string T = "No";
                if (a >b) {
                    b=  a;
                }
             
                Console.WriteLine(b);
    
                Console.ReadKey();
    
            }
        }
    }
    
    • 1

    信息

    ID
    22
    时间
    1000ms
    内存
    128MiB
    难度
    1
    标签
    递交数
    0
    已通过
    0
    上传者