求助大佬们,自测没问题,可是全不过,不知道为什么
查看原帖
求助大佬们,自测没问题,可是全不过,不知道为什么
269003
黎璃楼主2020/5/12 20:51
#include <stdio.h>
#include <stdlib.h>

int main() {
    int a, b, c;
    char d[3];
    scanf("%d %d %d", &a, &b, &c);
    getchar();
    for(int i = 0; i < 3; i ++) {
        scanf("%c", &d[i]);
    }
//将最小值赋给min,中值赋给mid,最大值赋给max    
    int max = a, min = a, mid = a;
    if(max > b && max > c) {
        max = max;        
    } else {
        if(b > c) {
            max = b;
        } else {
            max = c;
        }
    }
    if(min < b && min < c) {
        min = min;        
    } else {
        if(b < c) {
            min = b;
        } else {
            min = c;
        }
    }
    if(a != min && a != max) {
        mid = a;
    } else if(b != min && b != max) {
        mid = b;
    } else {
        mid = c;
    }
//    printf("%d, %d, %d", min, mid, max);
    for(int i = 0; i < 3; i ++) {
        if(d[i] == 'A') {
            printf("%d", min);
        } else if(d[i] == 'B') {
            printf("%d", mid);
        } else if (d[i] == 'C') {
            printf("%d", max);
        }
        if(i != 2) {
            printf(" ");
        }
    }
//    system("pause");
    return 0;
}

2020/5/12 20:51
加载中...