Why is it wrong? Please persuade me.

P1055 [NOIP2008 普及组] ISBN 号码

_0_1_ @ 2022-08-02 16:34:39

#include<bits/stdc++.h>
using namespace std;
char c[15];
int fl;
int t(char a){
    return a-'0';
}
int main(){
    cin>>c;
    int j=0;
    for(int i=0;i<=10;i++){
        if(i!=(1||5)){

        //There is the wrong,which should be modified to "i!=1&&i!=5"

            fl+=(++j)*t(c[i]);
        } 
    }
    fl%=11;
    if(fl==10) fl='X'-'0';
    if(c[12]=='0'+fl) cout<<"Right";
    else{
        c[12]='0'+fl;
        cout<<c;
    }
    return 0;
}

by _0_1_ @ 2022-08-03 15:36:28

@ajahjahah

wrong 确实有名词。。。译为错误的情况,刚又查了一下更多是译为非道德的坏事。不过用在这里确实不如fault(取“故障”之意)、error、mistake合适。大佬明察秋毫!


by _0_1_ @ 2022-08-03 15:38:12

@asdypeij 谢谢老师!


by asdypeij @ 2022-08-03 18:28:44

@00000110hh 懂了吧,加油!


上一页 |