Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: cj
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-04 13:36:15
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
int R = 0;
cin>>s;
int las =s[15] - '0';
s.pop_back();
for(int i=0;i<15;i++){
if((i+1)%2 != 0){
int nb = ((s[i] - '0')*2);
if(nb < 10){
R += nb;
}else{
R += nb%10;
R += nb/10;
}
}else{
R += s[i]-'0';
}
}
int ans = (10 - (R%10))%10;
if(ans == las){
cout<<"yes";
}else{
cout<<"no";
}
}