Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: randomguy
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-10 13:44:52
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <numeric>
#include <set>
#include <algorithm>
#define io() do { ios::sync_with_stdio(false); cin.tie(nullptr); } while(0)
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string a;
cin >> a;
char ln = a[a.size()-1];
string b(a.rbegin()+1,a.rend());
string c="";
for(int i=0;i<b.size();i++){
if((i+1)%2){
c+= to_string((b[i]-'0')*2);
}
else c+= b[i];
}
int s=0;
for(int i=0;i<c.size();i++){
s+=c[i]-'0';
}
if(ln-'0'==(10-(s%10))%10) cout << "yes";
else cout << "no";
}