Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: cyblox_boi

Problemset: บาร์โค้ด

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-16 09:26:15

#include <iostream>
using namespace std;

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

    string barcode;
    cin >> barcode;

    int k = 0;
    int l = 0;

    for (int i = barcode.length() - 2; i >= 0; i -= 2)
    {
        k += barcode[i] - '0';
        l += barcode[i - 1] - '0';
    }

    k *= 3;

    int result = k + l;
    int count = 0;

    while (result % 10 != 0)
    {
        count++;
        result++;
    }

    if (barcode[barcode.length() - 1] - '0' == count)
    {
        cout << "YES";
    }
    else
    {
        cout << "NO";
    }

    cout << '\n';

    return 0;
}