HUST Online Judge WebBoard
Problem 1120 >> 答案错误9%
201803010212 @ 2019-05-20 20:25:38
[ Quote ] [ Edit ] [ Delete ] 1#
#include<stdio.h>
int main()
{
char a[100];
int i,p,t=1,sum=0;
scanf("%s",a);
for(i=0;i<12;i++)
{
if(a[i]<='9'&&a[i]>='0')
{
sum=sum+(a[i]-48)*t;
t++;
}
}
p=sum%11;
if(p<=9)
{
if(p==a[12]-48)
printf("Right\n");
else
{
for(i=0;i<12;i++)
printf("%c",a[i]);
printf("%d\n",p);
}
}
else
{
if(a[12]=='X')
printf("Right\n");
else
{
for(i=0;i<12;i++)
printf("%c",a[i]);
printf("X\n");
}
}
return 0;
}
201703120121 @ 2019-05-21 20:52:27
[ Quote ] [ Edit ] [ Delete ] 2#
有个数据文件有多组数据输入。已重判。