Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: nxtx_ss
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-02 11:10:54
#include<iostream>
#include<vector>
#include<string.h>
using namespace std;
int main() {
int R=0;
string a;
cin>>a;
vector<int> v(16);
for(int i=0; i<16; i++){
v[i]=a[i]-'0';
}
for(int i=0; i<15; i++){
if(i%2==0){
v[i]=v[i]*2;
}
}
for(int i=0; i<15; i++){
if(v[i]>=0){
v[i]=(v[i]/10)+(v[i]%10);
}
R=R+v[i];
}
if (((10-(R%10)))%10==v[15]) {
cout<<"yes";
}
else{
cout<<"no";
}
}