Submission

Status:

[-SSSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: kawinavokiwi

Problemset: บาร์โค้ด

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-25 20:26:33

#include<bits/stdc++.h>

using namespace std;

int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    string a;
    cin >> a;
    int n;
    int total1 = 0;
    int total2 = 0;
    n = a.length();
    for(int i = n-2;i>=0;i--){
        if(i%2 == 0){
            total1 = total1 + a[i]-'0';
        }
    }for(int i = n-3;i>=0;i--){
        if(i%2 == 1){
            total2 = total2 + a[i]-'0';
        }
    }
    int total;
    total = total1 + 3*total2;
    /*cout << total1 << '\n' << total2 << '\n';
    cout << total << '\n';
    cout << a[n-1] << '\n';*/
    if((total + a[n-1]-'0') % 10 == 0){
        cout << "YES";
    }else{
        cout << "NO";
    }
}