您的位置:首页 > 其它

|Tyvj|NOIP2008|模拟|P1006 isbn

2016-08-16 10:23 489 查看
http://tyvj.cn/p/1006

一道简单的水题,注意X即可

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char ch[80];
int main ()
{
scanf("%s", ch);
int k = 0;
int tot = 0;
for (int i=0;i<11;i++)
{
if (ch[i]>='0'&&ch[i]<='9')
{
tot += (++k)*(ch[i]-'0');
}
}
tot %= 11;
if ((tot==10&&ch[12]=='X')||(tot==ch[12]-'0'))
{
printf("Right");
return 0;
}else
{
for (int i=0;i<12;i++) putchar(ch[i]);
if (tot==10) putchar('X'); else printf("%d", tot);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: