Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: nagornz_ph
Problemset: ตรวจบัตรเครดิต
Language: cpp
Time: 0.004 second
Submitted On: 2025-09-16 19:45:37
#include <stdio.h>
int main(){
char str[16];
scanf("%s", str);
int a[16];
for (int i = 0; i < 16; i++) {
a[i] = str[i] - '0';
}
int sum = 0;
for (int i = 0; i < 15; i++) {
if (i % 2 == 0) a[i] *= 2;
if (a[i] > 9) sum += a[i] % 10 + 1;
else sum += a[i];
}
if ((10 - (sum % 10)) % 10 == a[15]) {
printf("yes");
}
else {
printf("no");
}
}