sdut-1148 相加和最大值
生活随笔
收集整理的這篇文章主要介紹了
sdut-1148 相加和最大值
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
點擊打開鏈接
Copyright ? 2013-2017 SDUTACM Team. All Rights Reserved. #include <iostream> using namespace std; int main() {int a1,a2,a3,a,b,c;cin>>a1>>a2>>a3;a=a1+a2;b=a1+a3;c=a2+a3;int max;if(a>=b)max=a;elsemax=b;if(max>=c)cout<<max<<endl;elsecout<<c<<endl;return 0; }/*************************************************** User name: YT1658506207邵雪源 Result: Accepted Take time: 0ms Take Memory: 204KB Submit time: 2017-07-26 15:45:53 ****************************************************/
相加和最大值
Time Limit:?1000MS?Memory Limit:?65536KB Submit?Statistic?DiscussProblem Description
輸入三個整數a,b,c。并進行兩兩相加,最后比較相加和的最大值。Input
輸入數據包含三個整數,用空格分開。Output
輸出兩兩相加后的最大值。Example Input
1 2 3Example Output
5Hint
Author
SDUTACM運維技術中心. Sun Aug 13 2017 15:58:30 GMT+0800 (中國標準時間)?Copyright ? 2013-2017 SDUTACM Team. All Rights Reserved. #include <iostream> using namespace std; int main() {int a1,a2,a3,a,b,c;cin>>a1>>a2>>a3;a=a1+a2;b=a1+a3;c=a2+a3;int max;if(a>=b)max=a;elsemax=b;if(max>=c)cout<<max<<endl;elsecout<<c<<endl;return 0; }/*************************************************** User name: YT1658506207邵雪源 Result: Accepted Take time: 0ms Take Memory: 204KB Submit time: 2017-07-26 15:45:53 ****************************************************/
總結
以上是生活随笔為你收集整理的sdut-1148 相加和最大值的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: sdut-3102小鑫追女神
- 下一篇: sdut-1118 C语言实验——从大到