全Re??? !!!求大佬帮助

P4414 [COCI2006-2007#2] ABC

laoniubi @ 2024-12-10 21:40:23

测试没问题啊

#include <bits/stdc++.h>
using namespace std;
int main(){
int A,B,C,d;
cin>>A>>B>>C;
int h[3]={0};
if(A>B){
    d=A;
    A=B;
    B=d;
}
if(C<A){
    d=A;
    A=C;
    C=d;
}
if(C<B){
    d=B;
    B=C;
    C=d;}
char q;
for(int i=1;i<=3;i++){
    cin>>q;
    if(q=='A'){
        h[i]=A;
    }
        if(q=='B'){
        h[i]=B;
    }
        if(q=='C'){
        h[i]=C;
    }
}

for(int i=1;i<=3;i++){
    cout<<h[i];
    if(i==1 || i==2){
        cout<<" "; 
    }
}
}

by mcturtle @ 2024-12-10 21:42:32

数组h开大一点,越界了


by friend_me @ 2024-12-10 21:44:43

@laoniubi


by laoniubi @ 2024-12-10 21:44:56

@mcturtle ok AC了


by mcturtle @ 2024-12-10 21:46:07

@laoniubi 求互关


by laoniubi @ 2024-12-10 21:47:21

@mcturtle 已关


by mcturtle @ 2024-12-10 21:49:22

@laoniubi tks


|