1 条题解

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

    C :

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

    C++ :

    #include <iostream>
    #include <math.h>
    using namespace std;
    int  main()
    {
    	int a,b,c;
    	cin>>a>>b>>c;
    	if(a>=b&&a>=c)
    	{
    		cout<<a<<endl;
    	}
    	else if(b>=a&&b>=c)
    	{
    		cout<<b<<endl;
    	}
    	else if(c>=a&&c>=b)
    	{
    		cout<<c<<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(),c=input.nextInt();
            int m=Math.max(a,b);
            int n=Math.max(c,m);
            System.out.println(n);
        }
    }
    
    

    Python :

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

    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]);
                int max =0;
                if (a >= b && a >= c)
                {
                    max=a;
                }
                else if (b >= a && b >= c)
                {
                    max = b;
                }
                else { max = c; }
                Console.WriteLine(max);
    
                Console.ReadKey();
    
            }
        }
    }
    
    • 1

    信息

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