Submission

Status:

[-SSSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: letdown

Problemset: ตรวจบัตรเครดิต

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-09 08:06:55

#include <iostream>
#include <math.h>
#include <string.h>

using namespace std;
int main() {
    string s;
    cin >> s;

    int a = 0, b = 0, l;
    for (int i = 1; i <= 13; i++) {
        int d = int(s[i-1] - '0');
        if (i % 2 == 0) {
            a += d;
        }
        if (i % 2 == 1 && i >= 3) {
            b += d;
        }
    }
    l = int(s[0] - '0');

    if ((3*a+b+l) % 10 == 0) {
        cout << "YES";
    } else {
        cout << "NO";
    }
}