题解 | #[NOIP2008]ISBN号码#
[NOIP2008]ISBN号码
https://www.nowcoder.com/practice/95712f695f27434b9703394c98b78ee5
#include<stdio.h> int main() { char num[13] = {0}; int i = 0; int m = 0; for(i = 0; i < 13; i++) scanf("%c",&num[i]); int j = 0; int s = 0; for(i = 0,j = 1; i < 11; i++) { if(num[i] != '-') { s += (num[i]-'0')*j; j++; } } m = s % 11; if(m == num[12]-'0'||(m == 10 && num[12]=='X')) printf("Right\n"); else { if(m == 10) num[12] = 'X'; else num[12] = m + '0'; for(i = 0; i < 13; i++) printf("%c",num[i]); } return 0; }