Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: Whatthepoop

Problemset: ตรวจบัตรเครดิต

Language: c

Time: 0.002 second

Submitted On: 2025-10-10 23:58:51

#include <stdio.h>
#include <string.h>

int main(){
	char s[17];
	scanf("%s", &s);
	
	int temp = s[15] - '0';
	
	int pos = 1;
	int R = 0;
	for(int i = 14; i >= 0; i--){
		int digit = s[i] - '0';
		if(pos%2 == 1){
			digit *= 2;
			if(digit > 9) digit -= 9;
		}
		R += digit;
		pos++;
	}
	
	if(((10-(R % 10))%10) == temp) printf("yes");
	else printf("no");
	
	return 0;
}