Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: sakuragichan

Problemset: บาร์โค้ด

Language: cpp

Time: 0.005 second

Submitted On: 2026-09-08 07:34:25

#include <iostream>
#include <string>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string c;
    if (!(cin >> c)) return 0;

    int x = 0, y = 0;

    for (int i = 0; i <= 10; i += 2) {
        x += c[i] - '0';
    }

    for (int i = 1; i <= 11; i += 2) {
        y += c[i] - '0';
    }

    int sum = x + (y * 3);
    int check_digit = c[12] - '0';

    if ((sum + check_digit) % 10 == 0) {
        cout << "YES";
    } else {
        cout << "NO";
    }

    return 0;
}