Submission

Status:
[PPPPPPPPPP]

Score: 100

User: Angonnyyy

Problemset: บาร์โค้ด

Language: c

Time: 0.001 second

Submitted On: 2024-09-26 01:06:32

#include <math.h>
#include <stdio.h>

int main(){
    char barcode[14];
    int value1,value2;
    scanf("%s",&barcode);
    value1 = (barcode[1] + barcode[3] + barcode[5] + barcode[7] + barcode[9] + barcode[11] - 288)*3;
    value2 = (barcode[0] + barcode[2] + barcode[4] + barcode[6] + barcode[8] + barcode[10] - 288);
    if((value1+value2)%10==0){
        if(barcode[12]-48==0){
            printf("YES");
        }
        else{
            printf("NO");
        }
    }
    else if(10-((value1+value2)%10)==barcode[12]-48){
        printf("YES");
    }
    else{
        printf("NO");
    }
}