文章
39
粉丝
74
获赞
1
访问
20.5k
#include <stdio.h>
#include <stdlib.h>
char s[10000];
//x-xxx-xxxxx-x
int main()
{
scanf("%s",&s);
int sum=0;
sum=(s[0]-'0')*1+(s[2]-'0')*2+(s[3]-'0')*3+(s[4]-'0')*4+(s[6]-'0')*5+(s[7]-'0')*6+(s[8]-'0')*7+(s[9]-'0')*8+(s[10]-'0')*9;
sum%=11;
if((sum<=9&&(s[12]-'0')==sum)){
printf("Right");
}else if(sum<=9&&(s[12]-'0')!=sum){
for(int i=0;i<=11;i++)printf("%c",s[i]);
printf("%c",sum+'0');
}else if(sum==10&&s[12]=='X'){
printf("Right");
}else if(sum==10&&s[12]!='X'){
for(int i=0;i<=11;i++)printf("%c",s[i]);
printf("X");
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发