Create 1130_vij.cpp

This commit is contained in:
Kirigaya Kazuto 2016-06-01 22:52:57 +08:00
parent 1a7bcb71ca
commit 7fece3c3aa

30
QUSTOJ/1130_vij.cpp Normal file
View File

@ -0,0 +1,30 @@
#include<iostream>
using namespace std;
int main()
{
char a[100];
int a1[100],s=0;
for(int i=1;i<=13;i++)
{
cin>>a[i];
a1[i]=a[i]-48;
}
for(int i=1,g=1;i<=11;i++,g++)
{
if(a[i]=='-')i++;
s+=a1[i]*g;
}
if(s%11==10&&a[13]=='X'||s%11==a1[13]) cout<<"Right"<<endl;
else
{
for(int i=1;i<=12;i++)
{
cout<<a[i];
}
if(s%11==10) cout<<'X';
else cout<<s%11;
return 0;
}
}