1 条题解

  • 0
    @ 2025-4-7 21:28:46

    C :

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

    C++ :

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

    Pascal :

    var
      a,b,c:longint;
    begin
      readln(a,b,c);
      if (a<b) and (b<c) then writeln(c);
      if (a<c) and (c<b) then writeln(b);
      if (b<a) and (a<c) then writeln(c);
      if (b<c) and (c<a) then writeln(a);
      if (c<a) and (a<b) then writeln(b);
      if (c<b) and (b<a) then writeln(a);
    
    end.
    

    Java :

    import java.util.*;
    public class Main {
    	public static void main(String args[]) {
    		Scanner cin = new Scanner(System.in);
    		int[] i={0,0,0};
    		i[0]=cin.nextInt();
    		i[1]=cin.nextInt();
    		i[2]=cin.nextInt();
    		Arrays.sort(i);
    		System.out.println(i[2]);
    	}
    }
    

    Python :

    print max(int(x) for x in raw_input().split())
    
    • 1

    信息

    ID
    1259
    时间
    1000ms
    内存
    32MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者