Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: Poonthc
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.004 second
Submitted On: 2026-09-28 20:14:45
#include <bits/stdc++.h>
using namespace std;
int a[200];
int main()
{
int q=0,t=0;
string d;
cin>>d;
for(int i = 0;i <15;i++){
a[i] = int(d[i])-48;
}
q = d[15]-48;
for(int i = 0;i<15;i+=2){
a[i] *= 2;
}
for(int i = 0;i<15;i++){
if(a[i] >= 10){
t += (1 + a[i]%10);
}
else{
t+=a[i];
}
}
if(((10-(t%10))%10) == q){
cout << "yes";
}
else{
cout << "no";
}
}