|Tyvj|NOIP2008|模拟|P1006 isbn

    xiaoxiao2026-02-28  7

    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; }

    转载请注明原文地址: https://ju.6miu.com/read-1307459.html
    最新回复(0)