3
31
2015
0

Tyvj 1006 isbn

#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
	int c,a=0; string s="";
	for (int i=1;i<=9;++i)
	{
		c=getchar(); s+=c;
		if (c=='-') --i; //序号指数字的序号,连字符不算
		else if (c!='-')
			a=(a+(c-'0')*i)%11;
	}
	getchar(); c=getchar();
	if ((a==10 && c=='X') || a+'0'==c) { //读入特判
		cout<<"Right"; return 0;
	}
	cout<<s<<'-';
	if (a==10) cout<<'X'; //输出特判
	else cout<<a;
	return 0;
}
Category: 题解 | Tags: Tyvj 模拟 | Read Count: 182

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com