70pts求助 样例没过

P1055 [NOIP2008 普及组] ISBN 号码

huanglihuan @ 2023-10-25 20:51:57

#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll a,b,c;
ll t;

int main()
{
    scanf ("%d-%d-%d-%c",&a,&b,&c,&t);
    ll d = b / 100;
    ll e = b / 10 % 10;
    ll f = b % 10;
    ll g = c / 10000;
    ll h = c / 1000 % 10;
    ll i = c / 100 % 10;
    ll j = c / 10 % 10;
    ll k = c % 10;
    ll l = d * 2;
    ll m = e * 3;
    ll n = f * 4;
    ll o = g * 5;
    ll p = h * 6;
    ll q = i * 7;
    ll r = j * 8;
    ll s = k * 9;
    ll ans = a + l + m + n + o + p + q + r + s;
    ll sum = ans % 11;
    if (sum == 10)
        printf ("%d-%d-%d-X",a,b,c);
    else
        if (sum == t)
            printf ("Right");
        else
            printf ("%d-%d-%d-%d",a,b,c,sum);
    return 0;
}

by huanglihuan @ 2023-10-25 20:54:20


|