lbhs @ 2024-09-28 18:35:58
#include<bits/stdc++.h>
using namespace std;
int main() {
char x,y;
long long a,b,c;
cin>>a>>b>>c>>x>>y;
if(x=='A'){
if(y=='B')
cout<<a<<" "<<b<<" "<<c;
else
cout<<a<<" "<<c<<" "<<b;
}
if(x=='B'){
if(y=='C')
cout<<b<<" "<<c<<" "<<a;
else
cout<<b<<" "<<a<<" "<<c;
}
if(x=='C'){
if(y=='A')
cout<<c<<" "<<a<<" "<<b;
else
cout<<c<<" "<<b<<" "<<a;
}
return 0;
}
哪里错了
by woshizhangchi123 @ 2024-09-28 19:21:23
//试试这个,可以AC
#include <bits/stdc++.h>
using namespace std;
int a[4];
int main()
{
cin>>a[1]>>a[2]>>a[3];
sort(a+1,a+4);
string s;
cin>>s;
for(int i=0;i<3;i++){
if(s[i]=='A')cout<<a[1];
if(s[i]=='B')cout<<a[2];
if(s[i]=='C')cout<<a[3];
cout<<" ";
}
return 0;
}