为什么全错,求大佬指正

P4414 [COCI2006-2007#2] ABC

yatloimly @ 2024-11-05 22:40:33

#include<bits/stdc++.h>
using namespace std;
int main(){
    int x[4];
    cin>>x[1]>>x[2]>>x[3];
    sort(x,x+4);
    char a,b,c;
    cin>>a>>b>>c;
    if(a=='A') cout<<x[1];
    else if(a=='B') cout<<x[2];
    else if(a=='C') cout<<x[3];
    cout<<" ";
    if(b=='A') cout<<x[1];
    else if(b=='B') cout<<x[2];
    else if(b=='C') cout<<x[3];
    cout<<" ";
    if(c=='A') cout<<x[1];
    else if(c=='B') cout<<x[2];
    else if(c=='C') cout<<x[3];
    return 0;
}

样例过,但是WA,把测试点保存下来,发现输入后的输出跟我程序是一样的,怎么改啊


by Lisuyang @ 2024-11-05 22:43:50

@yatloimly

sort 写错了

sort(x+1,x+4);

by yatloimly @ 2024-11-05 22:46:48

@Lisuyang 哦哦,谢谢你


|