麻烦到家的方法

P1055 [NOIP2008 普及组] ISBN 号码

Kalpas_s2006 @ 2021-08-11 10:51:13


#include<stdio.h>
#include<cmath>
using namespace std;
int main()
{
    char a,b,c,d,e,f,g,h,i,j;
    scanf("%c-%c%c%c-%c%c%c%c%c-%c",&a,&b,&c,&d,&e,&f,&g,&h,&i,&j);
    int a1=a-48; int a2=b-48; int a3=c-48;
    int a4=d-48; int a5=e-48; int a6=f-48;
    int a7=g-48; int a8=h-48; int a9=i-48;
    int a10=j-48;
    if(a10==40)
    {
        a10=10;
    }
    int sum=a1+2*a2+3*a3+4*a4+5*a5+6*a6+7*a7+8*a8+9*a9;
    int q=sum%11;
    if(q%a10==0)
    {
        printf("Right");
    }
    else
    {
        if(q==10)
        {
            printf("%c-%c%c%c-%c%c%c%c%c-X",a,b,c,d,e,f,g,h,i);
        }
        else
        {
            printf("%c-%c%c%c-%c%c%c%c%c-%d",a,b,c,d,e,f,g,h,i,q);  
        }
    }
    return 0;
}

by N_z_ @ 2021-08-11 10:52:25

so?


by northXS @ 2021-08-11 10:53:56

确实有够麻烦


by int64 @ 2021-08-11 11:04:09

太强了,我举报了


by Phartial @ 2021-08-11 11:12:36

确实有够麻烦


by Kalpas_s2006 @ 2022-04-05 23:38:17

@int64 az 别啊.....


|