求调

P1055 [NOIP2008 普及组] ISBN 号码

MYD_DL17 @ 2024-08-04 19:52:51

#include <bits/stdc++.h>
using namespace std;
int main(){
    char s[15];
    for (int i = 1;i <= 13;i++){
        cin >> s[i];
    }
    int a = (int)s[1];
    int b = (int)s[3];
    int c = (int)s[4];
    int d = (int)s[5];
    int e = (int)s[7];
    int f = (int)s[8];
    int g = (int)s[9];
    int h = (int)s[10];
    int p = (int)s[11]; 
    int k;
    if (s[13] == 'X') k = 10;
    else k = (int)s[13];
    int t = a * 1+b*2+c*3+d*4+e*5+f*6+g*7+h*8 + p*9;
    int correct_m = t % 11;

    if (correct_m  == k){
        cout << "Right";
    }    
    else {
        for (int i  =1;i <= 12;i++){
            cout << s[i];
        }
        cout << correct_m;

    }
    return 0;

}

by Fur_Zes @ 2024-08-04 19:59:44

@MYD_DL17 你可以输出一下你的 t,对比下题目中的 158 看看你输出的是多少。


by Fur_Zes @ 2024-08-04 20:00:37

@MYD_DL17 不要忘记ASCALL码这个东西


by Fur_Zes @ 2024-08-04 20:01:20

哦是ASCII,wssb


by MYD_DL17 @ 2024-08-04 20:02:31

@As2O3 …… 谢谢


|