题解
2024-08-07 07:19:58
发布于:上海
1阅读
0回复
0点赞
#include<iostream>
#define max(a,b,c) max(max(a,b),c)
#define min(a,b,c) min(min(a,b),c)
using namespace std;
int a,b,c;
int midd;
void f(){
if((a==max(a,b,c)&&b==min(a,b,c))||(a==min(a,b,c)&&b==max(a,b,c))) midd=c;
else if((a==max(a,b,c)&&c==min(a,b,c))||(a==min(a,b,c)&&c==max(a,b,c))) midd=b;
else if((c==max(a,b,c)&&b==min(a,b,c))||(c==min(a,b,c)&&b==max(a,b,c))) midd=a;
}
int main(){
string s;
cin>>a>>b>>c>>s;
if(a==b&&b==c){
cout<<a<<" "<<b<<" "<<c;
return 0;
}
int maxx=max(a,b,c);
int minn=min(a,b,c);
f();
if(s[0]=='A'){
cout<<minn<<" ";
}
else if(s[0]=='B'){
cout<<midd<<" ";
}
else{
cout<<maxx<<" ";
}
if(s[1]=='A'){
cout<<minn<<" ";
}
else if(s[1]=='B'){
cout<<midd<<" ";
}
else{
cout<<maxx<<" ";
}
if(s[2]=='A'){
cout<<minn<<" ";
}
else if(s[2]=='B'){
cout<<midd<<" ";
}
else{
cout<<maxx<<" ";
}
}
这里空空如也
有帮助,赞一个