Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: Karatat007
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-02 10:18:00
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
string creditno;
cin >> creditno;
int sum = 0;
for(int i = 0;i < 16;++i){
int n = creditno[i] - '0';
if(i%2 == 0){
if(2*n >= 10) sum += 2*n - 9;
else sum += 2*n;
}
else sum += n;
}
if(sum%10 == 0) cout << "yes";
else cout << "no";
}