Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: Saizon

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-24 22:11:07

#include<iostream>
using namespace std;
int a[21];

int main(){
    string n;
    int s = 0;
    cin >> n;
    for(int i=2;i<=16;i++){
        a[16 - i] = int(n[i - 2] - '0');
    }
    for(int i=0;i<15;i+=2){
        a[i] *= 2;
    }
    for(int i=0;i<15;i++){
        if(a[i] / 10 >= 1){
            s += a[i] / 10 + a[i] % 10;
        }
        else{
            s += a[i];
        }
    }
    if((10 - (s % 10)) % 10 == int(n[15] - '0')){
        cout << "yes";
    }
    else{
        cout << "no";
    }
}