Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: Some1258
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.002 second
Submitted On: 2026-05-03 09:55:20
#include <iostream>
using namespace std;
int main() {
string s;
int down[16];
cin >> s;
for (int i = 0; i < 16; i++) {
down[15 - i] = s[i] - '0';
}
int sum = 0;
for (int i = 1; i < 16; i++) {
int digit = down[i];
if (i % 2 == 1) {
digit *= 2;
}
sum += digit / 10 + digit % 10;
}
int check = (10 - (sum % 10)) % 10;
if (check == down[0]) {
cout << "yes";
} else {
cout << "no";
}
}