kkkcs @ 2024-09-20 22:41:30
#include<bits/stdc++.h>
using namespace std;
int main(){
long long int q,b=0;
char a[3];
cin>>q>>a;
q/=10;
for(int i=0;i<3;i++){
if(a[i]=='B')b+=8;
else if(a[i]=='C')b+=7;
}
if(b==15)b=6;
else if(b>10)b/=2;
else if(b==10)b=1;
cout<<q*b;
return 0;
}
求助
by 焚魂 @ 2024-09-20 22:46:37
@zhenghanyu333 输入BBC的情况你这就不对了吧
by yuyongling @ 2024-09-20 22:49:27
emm 要保证a是最小的
by kkkcs @ 2024-09-20 22:56:06
@焚魂
#include<bits/stdc++.h>
using namespace std;
int main(){
long long int q,b=0;
char a[3];
cin>>q>>a;
q/=10;
for(int i=0;i<2;i++){
if(a[i]=='B')b+=8;
else if(a[i]=='C')b+=7;
}
if(b==15)b=6;
else if(b>10)b/=2;
else if(b==10)b=1;
cout<<q*b;
return 0;
}
还是90分
by Henry31415926 @ 2024-09-20 22:58:06
@zhenghanyu333 你没有考虑输入中没有B和C的情况
else if(b==10)b=1;
应改为
else if(b==0)b=1;
by Henry31415926 @ 2024-09-20 22:59:41
打错了,应该是 b = 10
by AlanBeaker @ 2024-09-20 23:29:08
俗话说的好:打表大法好
#include<bits/stdc++.h>
using namespace std;
string ask[9]={"AA","AB","AC","BA","BB","BC","CA","CB","CC"};
int ans[9]={10,8,7,8,8,6,7,6,7};
unsigned long long a;
string s;
int check(string x)
{
for(int i=0;i<=8;i++)
if(ask[i]==x)
return ans[i];
}
int main()
{
cin >> a >> s;
cout << a/10*check(s);
return 0;
}
by AlanBeaker @ 2024-09-20 23:30:16
@zhenghanyu333 求壶关
by kkkcs @ 2024-09-21 12:55:22
@Wuyuanpei @Henry31415926 @yuyongling @焚魂
已过感谢各位dalao,已关注
by ma_rui @ 2024-12-09 21:58: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;
}
求互关