Submission
Status:
[PPPP-SSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: rice_ot
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-14 11:36:36
#include <bits/stdc++.h>
using namespace std;
int main(){
string x; cin>>x;
char lx = x[x.length()-1];
x.resize(x.length()-1);
reverse(x.begin(), x.end());
string y = "";
for(int i = 0; i<x.length(); i++){
if(i%2== 0 )y+=to_string( (x[i]-'0')*2 );
else y+=x[i];
}
int tot = 0;
for(auto& i : y){
tot+=i-'0';
}
if((10 - (tot%10)%10) == lx-'0') cout<<"yes";
else cout<<"no";
}