Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: HawThorns
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.005 second
Submitted On: 2026-10-13 16:26:35
#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;
}