Submission

Status:

[PPPPPPPP-S]

Subtask/Task Score:

{0/100}

Score: 0

User: jackpapho

Problemset: บาร์โค้ด

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-30 22:25:35

#include <iostream>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    string n;
    int sum = 0;
    cin >> n;
    for (int i = 0;i < n.length()-1;i++){
        int num = n[i] - '0';
        if (i % 2 == 0) sum+=num;
        else sum+=num*3;
    }
    int ans = 10 - (sum % 10);
    if (ans == n[n.length()-1] - '0') cout << "YES";
    else cout << "NO";
    return 0;
}