Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: Prima
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-12 09:24:35
#include<iostream>
using namespace std;
int main(){
int r=0, x;
string s;
cin >> s;
for(int i=s.length()-2; i>=0; i--){
x=s[i]-'0';
if(i%2==0){
x*=2;
}
if(x<10){
r+=x;
}
else r+=x%10 +1;
}
if((10-r%10)%10== s[s.length()-1]-'0'){
cout << "yes";
}
else cout << "no";
}