Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: Bentley

Problemset: บาร์โค้ด

Language: cpp

Time: 0.003 second

Submitted On: 2026-10-08 22:05:53

#include <bits/stdc++.h>
using namespace std;
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string code; cin >> code;
    int ans=0;
    if(code.length()!=13){
        cout << "No";
        return 0;
    }
    for(int i=0;i<12;i++){
        if(i%2==0){
            ans+=char(code[i])-48;
        }
        else{
            ans+=3*(char(code[i])-48);
        }
    }
    ans+=char(code[12])-48;
    if(ans%10==0){
        cout << "YES";
    }
    else{
        cout << "NO";
    }
    return 0;
}