Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: porpeang
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.004 second
Submitted On: 2026-09-30 14:41:10
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<int>ja;
int a,b,c,d,e,k,sum=0,def=0;
string f;
cin>>f;
k = f[15] - '0';
int pos = 1;
for(int i = 14; i >= 0; i--){
int num = f[i] - '0';
if(pos % 2 != 0){
num *= 2;
}
sum += (num / 10) + (num % 10); // ⭕ รวมค่า sum ในลูปนี้ได้เลย
pos++;
}
def=(10-(sum%10))%10;
if(def==k){
cout<<"yes";
}
else{
cout<<"no";
}
}