_CD_ @ 2024-02-16 17:28:04
#include<iostream>
using namespace std;
int main(){
char a,b;
long long int x;
cin>>x>>a>>b;
if((a=='B'&&b=='C')||(b=='B'&&a=='C')){
cout<<x*0.6;
}else if((a=='B'&&b=='A')||(b=='B'&&a=='A')||(b=='B'&&a=='B')){
cout<<x*0.8;
}else if((a=='A'&&b=='C')||(b=='A'&&a=='C')||(b=='C'&&a=='C')){
cout<<x*0.7;
}else{
cout<<x;
}
return 0;
}
by xiangzhenze611 @ 2024-02-16 17:40:48
这样就行啦
#include<iostream>
using namespace std;
int main(){
char a,b;
long long int x;
cin>>x>>a>>b;
if((a=='B'&&b=='C')||(b=='B'&&a=='C')){
cout<<x*6/10;
}else if((a=='B'&&b=='A')||(b=='B'&&a=='A')||(b=='B'&&a=='B')){
cout<<x*8/10;
}else if((a=='A'&&b=='C')||(b=='A'&&a=='C')||(b=='C'&&a=='C')){
cout<<x*7/10;
}else{
cout<<x;
}
return 0;
}