Flower_Bloom @ 2022-07-01 22:22:00
大佬求助,本蒟蒻第四个测试点过不去,自己算的都对。90分求助```cpp
using namespace std;
int main()
{
int a,b,c,d;
string x;
scanf ("%d-%d-%d-",&a,&b,&c);
getline(cin,x);
if (x=="X")
{
d=10;
}
else
d=atoi(x.c_str());
int e,f,g;
int erws=b/100;
int sanws=(b/10)%10;
int siws=b%10;
int wuws=c/10000;
int liuws=(c/1000)%10;
int qiws=(c/100)%10;
int baws=(c/10)%10;
int jiuws=c%10;
e=(1*a+2*erws+3*sanws+4*siws+5*wuws+6*liuws+7*qiws+8*baws+9*jiuws);
g=e/11;
f=e-11*g;
if (f==d)
{
cout<<"Right";
}
else if (f!=d)
{
if (f==10)
{
cout<<a<<"-"<<b<<"-"<<c<<"-"<<"X";
system ("pause");
}
else
{
cout<<a<<"-"<<b<<"-"<<c<<"-"<<f<<endl;
system ("pause");
}
}
system("pause");
}
by tommyfj @ 2022-07-01 22:39:42
@Mant1e 建议用数组做
by tommyfj @ 2022-07-01 22:40:41
@Mant1e 下次发帖时记得格式弄好点
by tommyfj @ 2022-07-01 22:41:37
@Mant1e 先下线了
by Xeqwq @ 2022-07-01 22:45:39
@Mant1e 请学习数组
by Flower_Bloom @ 2022-07-02 08:22:29
谢大佬指点!