寻找吕布
Problem:11
Time Limit:1000ms
Memory Limit:65536K
Description
三国里面吕布第一,赵云第二,典韦、关羽和马超分别是第3、第4和第5名,这是按武将的勇猛值和必杀技值的和来排名的,即武术值=勇猛值+必杀技值,下面给出这5人的勇猛值和必杀值,请你找出吕布的武术值。
Input
输入数据有多组,每组数据2行,第一行是5人的勇猛值,第二行是5人的必杀技值。勇猛值和必杀值是整数哦(32位)
Output
输出吕布的武术值。
Sample Input
1 2 3 4 5 1 2 3 4 5 20 21 22 45 87 1 100 8 99000 23
Sample Output
10 99087
Hint
吕布的勇猛值和必杀技值都是第一的!
Source
陈宇<br /><span id="_xhe_temp" width="0" height="0"><br /></span>#include <stdio.h> #include <stdlib.h> int main() { int i,temp,n=2; int ym=0,bs=0; while(scanf("%d",&temp)!=-1) { ym=0,bs=0; if(ym<temp) ym=temp; for(i=1;i<=4;i++) { scanf("%d",&temp); if(ym<temp) ym=temp; } for(i=1;i<=5;i++) { scanf("%d",&temp); if(bs<temp) bs=temp; } printf("%d\n",bs+ym); } return 0; }