40分求助

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

woshiSBSBSBSB @ 2024-07-18 11:22:24

#include <iostream>
using namespace std;
int main(){
    long long x;
    int c;
    char a,b;
    cin>>x>>a>>b;
    if(a!='C'&&b=='B'||a=='B'&&b!='C'){
        c=1.0*x*0.8;
        cout<<c;
    }else if(a!='B'&&b=='C'||a=='C'&&b!='B'){
        c=1.0*x*0.7;
        cout<<c;
    }else if(a=='C'&&b=='B'||a=='B'&&b=='C'){
        c=1.0*x*0.6;
        cout<<c;
    }else if(a=='A'&&b=='A'){
        cout<<x;
    }
    return 0;
}

by Kavin_0409 @ 2024-07-18 12:09:46

给你个正解 为啥不看题解

#include <iostream>
using namespace std;
long long x;
char A,B;
int a,b;
int main(){
    cin>>x>>A>>B;
    a=min(A,B);b=max(A,B);
    if(b=='B')x=x/10*8;
    if(a!='B'&&b=='C')x=x/10*7;
    if(a=='B'&&b=='C')x=x/10*6;
    cout<<x;
    return 0;
}

by woshiSBSBSBSB @ 2024-07-18 16:50:42

thank you


by wangyutong1208 @ 2024-08-02 21:53:09

@Kavin_0409 题解有误


by wangyutong1208 @ 2024-08-02 21:58:59

@Kavin_0409 不是,哥们儿!

你的答案也是错的啊!


by wangyutong1208 @ 2024-08-02 22:02:29

@Kavin_0409 搞错了!

你对的,我少了个输出!

I'm sorry~~~


by ma_rui @ 2024-12-09 21:59:02

#include<bits/stdc++.h>
using namespace std;
long long n;
char a[3];
bool b,c; 
int main()
{
    cin>>n;
    for(int i=1;i<=2;i++){
    cin>>a[i];
    if(a[i]=='B')b = 1;
    if(a[i]=='C')c = 1;
    }
    if(!b&&!c)cout<<n;
    else if(b&&!c)cout<<n/10*8;
    else if(c&&!b)cout<<n/10*7;
    else cout<<n/10*6;
    return 0;
}

求互关


|