Submission

Status:

[-SSSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: HawThorns

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

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-13 16:25:17

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
       long long inpt,i = 0,total = 0,last;
       string stuff[2] = {"No","Yes"};
       vector<int> arr;
       cin >> inpt;
       last = inpt % 10;
       inpt /= 10;
       for(;inpt > 0;i++){
              arr.push_back((inpt % 10) * ((i % 2 == 0)+1));
              inpt /= 10;
       }
       for(const int &var : arr){
              total += (var / 10) + (var % 10);
       }
       int lastcheck = (10 - (total % 10)) % 10;
       cout << stuff[lastcheck == last];
       return 0;
}