Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: sulinx
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-24 18:40:44
#include <bits/stdc++.h>
using namespace std;
int main(){
string str;
cin >> str;
int cred[16];
for(int i = 0;i<16;i++){
cred[i] = str[i] - 48;
}
int R = 0;
for(int i = 0;i<15;i++){
if(i%2==0){
cred[i] *= 2;
}
if(cred[i]<10){
R+=cred[i];
}else{
R+=cred[i]/10 + cred[i]%10;
}
}
if((10-(R%10))%10 == cred[15]){
cout << "yes";
}else{
cout << "no";
}
}