Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: vachirasawin
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.002 second
Submitted On: 2026-03-13 16:43:38
// grader-chan
// c1_bkk67_5.cpp | c1_bkk67_5
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string code;
cin >> code;
int total = 0;
for (int i = 0; i < code.size() - 1; i++) {
int n = code[i] - '0';
if (i % 2 == 0) {
if (n >= 5) {
total += 1 + ((n * 2) % 10);
} else {
total += n * 2;
}
} else {
total += n;
}
}
cout << (((10 - (total % 10)) % 10 == code[code.size() - 1] - '0') ? "yes" : "no");
return 0;
}