求解!

P1055 [NOIP2008 普及组] ISBN 号码

CSP_zyh @ 2022-07-11 22:39:05

#include<iostream>
using namespace std;
int main(){
    char a[10];
    char c[13]={};
    char d[13]={};
    for(int i=0;i<10;i++){
        cin>>a[i];
        a[i]=c[i];
        if(a[i]=='-'){
            cin>>a[i];
        }
    }
    int n;
    for(int i=0,j=1;i<10;i++,j++){
        n=a[i]*j;
    }
    n%=11;
    if(a[9]==n){
        cout<<"Right";
    }
    else{
        for(int i=0;i<12;i++){
            d[i]=c[i];
            cout<<d[i];
        }
        cout<<char(n);
    }
    return 0;
}

by TheSky233 @ 2022-07-11 22:43:22

        a[i]=c[i];

c[i]=a[i]


by CSP_zyh @ 2022-07-17 07:15:04

@TheSky233好像也不太对诶


|