Submission

Status:

[P-SSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: Sunsblad

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

Language: cpp

Time: 0.003 second

Submitted On: 2026-09-29 21:09:25

#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');
            //cout<<"tmp = "<<tmp << '\n';
            tmp *= 2;
            while(tmp != 0){
                tot += tmp % 10;
                tmp /= 10;
            }
        }else{
            tot += int(v[i]) -48;
        }
    }
    //cout<<v<<'\n';
    //cout<<tot;
    tot = (10 - (tot % 10));
    if(tot == 8)cout<<"yes";else cout<<"no";
}