Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: blaboo123
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-11 12:55:33
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string number_str;
cin >> number_str;
int sum = 0;
for (int i = 0; i < 15; i++) {
int digit = number_str[i] - '0';
if (i % 2 == 0) {
digit *= 2;
if (digit > 9) {
digit -= 9;
}
}
sum += digit;
}
int check_digit = number_str[15] - '0';
int total_sum = sum + check_digit;
if (total_sum % 10 == 0) {
cout << "yes" << endl;
} else {
cout << "no" << endl;
}
return 0;
}