#18487: C WA 全程if else表示 找不出錯誤


danny240242168@gmail.com (林暉恩)

School : 臺北市立大安高級工業職業學校
ID : 98649
IP address : [220.135.49.243]
Last Login :
2019-08-09 16:30:56
d984. 棄保效應 -- 板橋高中教學題 | From: [220.135.49.243] | Post Date : 2019-07-17 19:11

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

int main(){
int a,b,c,max,mid,min;
while(scanf("%d%d%d",&a,&b,&c)!=EOF){
if(a>b&&a>c){
max=a;
if(b>c){
mid=b;
min=c;
if(max>(mid+min)){
printf("A\n");
}else{
printf("B\n");
}
}else{
mid=c;
min=b;
if(max>(mid+min)){
printf("A\n");
}else{
printf("C\n");
}
}
}else if(b>a&&b>c){
max=b;
if(a>c){
mid=a;
min=c;
if(max>(mid+min)){
printf("B\n");
}else{
printf("A\n");
}
}else{
mid=c;
min=a;
if(max>(mid+min)){
printf("B\n");
}else{
printf("C\n");
}
}
}else{
max=c;
if(a>b){
mid=a;
min=b;
if(max>(mid+min)){
printf("C\n");
}else{
printf("A\n");
}
}else{
mid=b;
min=a;
if(max>(mid+min)){
printf("C\n");
}else{
printf("B\n");
}
}
}

}


return 0;
}

 
ZeroJudge Forum