游客 Signup | Login
中文 | En

1709 - 初级第五课——求三个数的最大数

已知有三个不等的数,将其中的最大数找出来。

Input

输入只有一行,包括3个整数。之间用一个空格分开。

Output

输出最大数

Examples

Input

1 5 8 

Output

8

Solution C

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a>=b)
    {
        if(a>=c)
            printf("%d",a);
        else
            printf("%d",c);
    }
    if(b>a)
    {
        if(b>=c)
            printf("%d",b);
        else
            printf("%d",c);
    }

}

Solution C++

#include<cstdio>
int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	a = a > b ? a : b;
	a = a > c ? a : c;
	printf("%d\n",a);
	return 0;
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题