shanyisang @ 2023-10-20 21:07:28
#include <bits/stdc++.h>
using namespace std;
int x;
double sum=0;
char a,b;
int main(){
cin>>x;
cin>>a>>b;
if(a=='B'){
if(b=='C'){
sum=x*0.6;
}else{
sum=x*0.8;
}
cout<<sum;
}
if(a=='A'){
if(b=='A'){
sum=x;
}else if(b=='B'){
sum=x*0.8;
}else if(b=='C'){
sum=x*0.7;
}
cout<<sum;
}
if(a=='C'){
if(b=='A'){
sum=x*0.7;
}else if(b=='B'){
sum=x*0.6;
}else if(b=='C'){
sum=x*0.7;
}
cout<<sum;
}
return 0;
}
by WangYinxiAlex @ 2023-10-21 10:40:36
@shanyisang 问题是他如果有小数点怎么办?
by shanyisang @ 2023-10-21 19:23:58
@WangYinxiAlex 但是如果转化为了字符串是不是就不能进行数学计算了