MonicAsh @ 2024-10-27 20:58:45
只有70分求调,谢谢大佬!
#include<stdio.h>
int main ()
{
int a,b;
long c;
char d;
scanf("%d-%d-%ld-%c",&a,&b,&c,&d);
long x;
int y;
x=a*1+b/100*2+b%100/10*3+b%10*4+c/10000*5+c%10000/1000*6+c%1000/100*7+c%100/10*8+c%10*9;
y=x%11;
switch(y==d){
case 1:printf("Right");break;
default:if(y==10){
d='X';
printf("%01d-%03d-%05ld-%c",a,b,c,d);
}
else
printf("%01d-%03d-%05ld-%1d",a,b,c,y);
}
}
by wk123_123 @ 2024-10-27 21:09:54
@MonicAsh
#include <bits/stdc++.h>
using namespace std;
int main()
{
string a;
cin>>a;
int j=1,h=0;
int q=0;
for(int i=0;i<=a.size()-2;i++)
{
if(isdigit(a[i]))
{
h+=(a[i]-'0')*j;
j++;
}
}
if(isdigit((a[a.size()-1])))
{
q=(a[a.size()-1]-'0');
}
else
{
q=10;
}
if(h%11==q)
{
cout<<"Right";
}
else
{
if(h%11>=1&&h%11<=9)
{
a[a.size()-1]=h%11+'0';
}
else
{
a[a.size()-1]='X';
}
cout<<a;
}
return 0;
}
by MonicAsh @ 2024-10-27 21:48:28
@wk123_123 感谢!(但是大佬有没有看出我问题出在哪啊找不到)