Submission
Status:
[PPPP-SSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: lupniexx
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.003 second
Submitted On: 2025-09-25 19:20:07
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main(){
string s;
int n[16];
int r=0;
cin >> s;
int len = s.length();
for(int i=0;i<len;i++){
n[i]=s[i]-48;
}
for(int i = 0; i < 15; i++) {
int digit = n[i];
if(i % 2 == 0) {
digit *= 2;
if(digit > 9) digit -= 9;
}
r += digit;
}
if(10-(r%10)%10==n[len-1]){cout<<"yes";}
else {cout << "no";}
}