Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: shurye

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

Language: cpp

Time: 0.005 second

Submitted On: 2026-10-11 22:47:07

#include <iostream>
#include <string>
#include <algorithm>
using namespace std ;
string code;
int main () {
    cin >> code ;
    int x = code[15]-48;
    code.pop_back();
    reverse(code.begin(),code.end());
    int sum = 0;
    for (int i = 0 ; i < code.length() ; i++){
        if(i%2==0){
            sum += ((code[i]-48)*2)%10 +((code[i]-48)*2)/10 ;
        }else{
            sum += int(code[i])-48 ;
        }
    }cout << ( ((10 - (sum % 10)) % 10 ) == x ? "yes" : "no") ;
}