You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
459 B
40 lines
459 B
#include<iostream>
|
|
#include <stdlib.h>
|
|
using namespace std;
|
|
int main() {
|
|
char a[13];
|
|
int sum=0;
|
|
for(int i=0; i<13; i++) {
|
|
cin >>a[i];
|
|
}
|
|
|
|
|
|
int k=0;
|
|
for(int i=0; i<11; i++) {
|
|
if(a[i]!='-') {
|
|
k++;
|
|
int b=a[i]-48;
|
|
sum+=b*k;
|
|
}
|
|
}
|
|
|
|
int c=sum%11;
|
|
char c2;
|
|
if(c==10) {
|
|
c2='X';
|
|
} else {
|
|
c2=c+48;
|
|
}
|
|
|
|
if(c2==a[12]) {
|
|
cout<<"Right"<<endl;
|
|
return 0;
|
|
} else {
|
|
a[12]=c2;
|
|
for(int i=0; i<13; i++) {
|
|
cout<<a[i];
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
} |