Submission
Status:
[PPPPPPPPPP]
Score: 100
User: Monasm
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.002 second
Submitted On: 2024-11-18 10:52:30
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;cin >> s;
int a[15];
for(int i=14;i>=0;i--){
int x = s[i]-'0';
if(!(i%2)){
x*=2;
}
a[i] = x;
}
int r=0;
for(int i=14;i>=0;i--){
while(a[i]>0){
r+=a[i]%10;
a[i]/=10;
}
}
if((10-(r%10))%10 == s[15]-'0'){
cout<<"yes";
}
else{
cout<<"no";
}
}