Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: rice_ot

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-10-14 11:37:24

#include <bits/stdc++.h>
using namespace std;

int main(){
    string x; cin>>x;
    char lx = x[x.length()-1];
    x.resize(x.length()-1);
    reverse(x.begin(), x.end());

    string y = "";
    for(int i = 0; i<x.length(); i++){
        if(i%2== 0 )y+=to_string( (x[i]-'0')*2 );
        else y+=x[i];
    }
    int tot = 0;
    for(auto& i : y){
        tot+=i-'0';
    }
    if(((10 - (tot%10))%10) == lx-'0') cout<<"yes";
    else cout<<"no";
}