相加和最大值 (sdut oj)

来源:互联网 发布:剑三最美萝莉脸型数据 编辑:程序博客网 时间:2024/06/03 21:43


相加和最大值

Time Limit: 1000MS Memory Limit: 65536KB


Problem Description

输入三个整数a,b,c。并进行两两相加,最后比较相加和的最大值。


Input

输入数据包含三个整数,用空格分开。


Output

输出两两相加后的最大值。


Example Input

1 2 3


Example Output

5


Hint

Author








参考代码



#include <stdio.h>void main(){    int a,b,c,sum1,sum2,sum3,max;    scanf("%d%d%d",&a,&b,&c);    sum1 = a + b;    sum2 = a + c;    sum3 = b + c;    if(sum1>sum2)        max = sum1;    else        max = sum2;    if(max>sum3)        printf("%d",max);    else        printf("%d",sum3);}



0 0
原创粉丝点击