Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: CA

Problemset: บาร์โค้ด

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-21 11:42:42

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

int main() {
    long int n;
    cin >> n;
    int chk = n % 10;
    n = (n - chk) / 10;
    int s1 = 0, s2 = 0;
    for (int i = 0; i < 12; i++) {
        int cd = n%10;
        if (i % 2 == 0) {
            s1 += cd;
        }
        else {
            s2 += cd;
        }
        n = (n - cd) / 10;
    }
    s1 *= 3;
    int s3 = s1 + s2;
    if (!((s3 + chk) % 10)) {
        cout << "YES\n";
    }
    else {
        cout << "NO\n";
    }
    return 0;
}