题解 | #[NOIP2008]ISBN号码#
[NOIP2008]ISBN号码
http://www.nowcoder.com/practice/95712f695f27434b9703394c98b78ee5
#include <stdio.h> int main(){ int l,c,b; char s; int n=0; scanf("%d-%d-%d-%c",&l,&c,&b,&s); int l1=l,c1=c,b1=b; n+=l*1; int cs=100; for(int i = 2;i < 5;i++){ n+=(c/cs)*i; c%=cs; cs/=10; } cs=10000; for(int i = 5; i < 10; i++){ n+=(b/cs)*i; b%=cs; cs/=10; } n%=11; if(n==(int)(s-'0')||(n==10&&s=='X'))printf("Right"); else if(n!=10)printf("%d-%d-%d-%d",l1,c1,b1,n); else if(n==10)printf("%d-%d-%d-X",l1,c1,b1); return 0; }