Binah_OVO @ 2024-12-09 19:41:19
测试点#2死命过不去啊啊啊啊
#include <bits/stdc++.h>
using namespace std;
char a[20];
int tot,y;
int main()
{
for(int i=1;i<=13;i++)
scanf("%c",&a[i]);
for(int i=1;i<=12;i++)
{
if(a[i]=='-')
continue;
tot+=(a[i]^'0');
}
y=tot%11;
if(y==(a[13]^'0')||(y==10&&a[13]=='X'))
printf("%s","Right");
else
{
for(int i=1;i<=12;i++)
printf("%c",a[i]);
y==10?printf("%d",y):printf("%c",'X');
}
return 0;
}
可恶的洛谷
by __AC__WA__ @ 2024-12-29 15:08:12
#include<bits/stdc++.h>
using namespace std;
int main(){
string ISBN;
int sum=0;
int jiaoyan=0;
cin>>ISBN;
int n=1;
for(int i=0;i<11;i++){
if(ISBN[i]!='-'){
jiaoyan+=(ISBN[i]-'0')*n;
n++;
}
}
jiaoyan%=11;
if(jiaoyan==10)jiaoyan='X';
else jiaoyan=jiaoyan+'0';
if(jiaoyan==ISBN[12]){
cout<<"Right";
}
else{
ISBN[12]=jiaoyan;
cout<<ISBN;
}
return 0;
}