10分求助!! !

B3720 [语言月赛202303] Out for Dinner B

luoguplay @ 2025-01-10 17:24:31

#include <iostream>
using namespace std;
int main()
{
    int x;
    char a, b;
    cin >> x >> a >> b;
    if(a != 'B' && a != 'C' && b != 'B' && b != 'C')//既没购买B菜也没购买C菜
    {
        cout << x;
    }
    if(a == 'B' && b == 'B' && a != 'C' && b != 'C')//购买了B菜,但没购买C菜
    {
        cout << x * 0.8;
    }
    if(a == 'C' && b == 'C' && a != 'B' && b != 'B')//购买了C菜,但没购买B菜
    {
        cout << x * 0.7;
    }
    if((a == 'B' && b == 'C') || (a == 'C' && b == 'B'))//既购买了B菜也购买了C菜
    {
        cout << x * 0.6;
    }
    return 0;
}

by chenyuan3 @ 2025-01-10 18:16:09

对于 100\% 的数据,保证 10\le x\le10^{18}

请开 long long


by terry1030 @ 2025-01-10 18:30:29

long long


by luoguplay @ 2025-01-10 19:27:07

@chenyuan3@terry1030 还是错


by chenyuan3 @ 2025-01-10 19:57:17

@luoguplay 在你的代码中只有 BB 是八折,而题意是 AB 也是八折。同理,七折也有可能是 AC


|