Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: uraniumconsumer

Problemset: บาร์โค้ด

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-26 14:48:24

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

int main(){
    string bar;
    cin >> bar;
    
    // even = 1, 3, 5, 7, 9, 11
    // odd = 0, 2, 4, 6, 8, 10
    int even = 0;
    for(int i=1; i<=11; i=i+2){
        even = even + (bar[i] - '0');
    }

    even = even * 3;

    int odd = 0;
    for(int j=0; j<= 10; j=j+2){
        odd = odd + (bar[j] - '0');
    }

    int sum = even+odd;

    if((sum + (bar[12] - '0'))%10==0){
        cout << "YES";
    }
    else{
        cout << "NO";
    }

}