|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;
}
一道简单的水题,注意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;
}
相关文章推荐
- noip2008 ISBN号码 (模拟)
- 【模拟 集合】[NOIP2008普及组]立体图 tyvj1009
- 【模拟 集合】[NOIP2008普及组]立体图 tyvj1009
- 【NOIP2008】【模拟】T1 笨小猴 题解
- NOIP2008 立体图 Codevs 1149 Tyvj 1009
- 【BSOJ1724】【bzoj3032】TYVJ P1924 【NOIP2013模拟】七夕祭
- NOIP2008 普及组T1 ISBN号码 解题报告-S.B.S.
- NOIP2008 普及组T1 ISBN号码 解题报告-S.B.S.
- NOIP模拟9.16(TYVJ NOIP2017模拟赛D1)
- [NOIP2008]双栈排序 【二分图 + 模拟】
- 【模拟】【NOIP2008】笨小猴 word
- NOIP 2008 普及组 复赛 isbn ISBN号码
- |Tyvj|NOIP2013|模拟|P2772 表达式求值
- jozj. 3927. 【NOIP2014模拟11.6】可见点数 洛谷 P2158 [SDOI2008]仪仗队
- |Tyvj|NOIP2008|动态规划|P1011 传纸条
- TYVJ-1011 / NOIP2008 传纸条
- NOIP2008:ISBN号码
- noip2008 立体图 (字符串+模拟)
- 洛谷 P1006 [NOIP2008 T3] 传纸条
- NOIP2008 普及组T1 ISBN号码 解题报告-S.B.S.