Submission

Status:

[P-SSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: Sunsblad

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-30 09:05:53

#include<iostream>
#include<string>
using namespace std;
int main(){
    string v;
    int tot = 0;
    cin>>v;

    for(int i = 0; i < v.size() - 1; i++){
        if(i % 2 == 0){
            int tmp;
            tmp = int(v[i])-int('0');
            tmp *= 2;
            //cout<<"tmp = "<<tmp << '\n';
            while(tmp != 0){
                tot += tmp % 10;
                tmp /= 10;
            }
        }else{
            int tmp = v[i] - 48;
            //cout<<"tmp = "<<tmp;
            tot += int(v[i]) -48;
        }
    }
    //cout<<v<<'\n';
    //cout<<tot;
    tot = (10 - (tot % 10)) % 10;
    if(tot == 8)cout<<"yes";else cout<<"no";
}