大佬们,求助,为什么只能输出两个数

P4414 [COCI2006-2007#2] ABC

kgwhy1 @ 2024-07-28 14:10:13

#include<stdio.h>
int min(int a,int b);
int max(int a,int b);
int main()
{
    int a[3];
    char c;
    int m,b,n;
    for(int i=0;i<3;i++)
    {
        scanf("%d",&a[i]);
    }

    int sum=a[0]+a[1]+a[2];
    m=min(min(a[0],a[1]),a[2]);
    n=max(max(a[0],a[1]),a[2]);
    b=sum-m-n;
    for(int i=0;i<3;i++)
    {
        scanf("%c",&c);
        if(c=='A')  printf("%d ",m);
        else if(c=='B')  printf("%d ",b);
        else if(c=='C')  printf("%d ",n);
    }
    return 0;

}
int min(int a,int b)
{
    if(a>b) return b;
    else return a;
}
int max(int a,int b)
{
    if(a<b) return b;
    else return a;
}

by meifan666 @ 2024-07-30 22:05:55

@kgwhy1 %c吃空格和回车,改成cin即可,求关


|