Chen_zi_long @ 2024-09-05 20:20:00
#include <bits/stdc++.h>
using namespace std;
int main(){
long long x;
char a, b;
cin >> x >> a >> b;
int y = 10;
if (a > b) swap(a, b);
if (a == 'B') {
if (b == 'C') {
y = 6;
}
else {
y = 8;
}
}
else if (b == 'C') {
y = 7;
}
cout << x / 10 * y << endl;
}
by zhanghengrui0502 @ 2024-09-05 20:31:47
根据题意模拟即可,求关~
#include<bits/stdc++.h>
using namespace std;
int main(){
long long x;
char a,b;
cin>>x;
cin>>a>>b;
if(a=='B'&&b!='C')cout<<x/10*8;
else if(a!='C'&&b=='B')cout<<x/10*8;
else if(a=='C'&&b!='B')cout<<x/10*7;
else if(a!='B'&&b=='C')cout<<x/10*7;
else if(a=='B'&&b=='C')cout<<x/10*6;
else if(a=='C'&&b=='B')cout<<x/10*6;
else cout<<x;
return 0;
}
by zhanghengrui0502 @ 2024-09-05 20:34:34
且你判断的情况不全,可以再试着改一改~~
by Chen_zi_long @ 2024-09-05 21:26:40
@zhanghengrui0502 已关(爱你呦)
by chenzhishuo2012 @ 2024-09-18 13:17:41
@Chen_zi_long 求互关
#include<bits/stdc++.h>
#define int long long
#define double long double
#define endl '\n'
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
int x;
char a,b;
signed main(){
ios;
cin>>x>>a>>b;
if(a=='A'&&b=='B'||a=='B'&&b=='A')cout<<x/10*8<<endl;
else if(a=='A'&&b=='C'||a=='C'&&b=='A')cout<<x/10*7<<endl;
else if(a!=b)cout<<x/10*6<<endl;
else if(a=='A')cout<<x<<endl;
else if(a=='B')cout<<x/10*8<<endl;
else cout<<x/10*7<<endl;
return 0;
}
by ma_rui @ 2024-12-09 21:55:48
怎么都是直接判断的呀?
AC代码
#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;
}
@zhanghengrui0502谢谢 让我AC 你那个n/10乘8我一开始写的是n*8