chenxi797 @ 2023-09-12 20:41:58
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n;
char a,b;
cin >> n >> a >> b;
if (a != 'B' && a != 'C' && b != 'B' && b != 'C')
cout << n;
else if ((a == 'B' && b != 'C') || (b == 'B' && a != 'C'))
cout << n * 0.8;
else if ((a == 'C' && b != 'B') || (b == 'C' && a != 'B'))
cout << n * 0.7;
else if ((a == 'B' && b == 'C') || (a == 'C' && b == 'B'))
cout << n * 0.6;
}
by AbCdikun @ 2023-09-12 20:47:46
你换种思路,不用这么麻烦,
by chenxi797 @ 2023-09-12 20:52:38
@AbCdikun 主要这种简单
by chenxi797 @ 2023-09-12 20:52:57
标题打错了,是20分
by xuchuhan @ 2023-09-12 20:58:30
@chenxi797 n*0.8
换为 n/10*8
,n*0.7
换为 n/10*7
,n*0.6
换为 n/10*6
,会出现精度问题。
by chenxi797 @ 2023-09-12 20:59:03
@xuchuhan 稍等,我看看
by chenxi797 @ 2023-09-12 21:00:32
为啥这么卡啊
by chenxi797 @ 2023-09-12 21:01:14
@xuchuhan AC了,thx
by XiaochenPRC @ 2023-09-14 23:10:08
@xuchuhan 帅飞了 在这里找到了正确答案 困惑了很久