Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: Prap

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-09-26 12:35:44

#include <iostream>;
#include <string>;
using namespace std;
int main() {
    string start;
    int i,sum,a,b,c;
    sum = 0;
    int box[16] = {0};
    cin>>start;
	for (i = 0; i<16; i++) {
		box[i] = int(start[i]-48);
	}
	for (i = 0; i<15; i+=2) {
		box[i] = 2*box[i];
		if (box[i] > 9) {
			box[i] = box[i]%10 + 1;
		}
	}
	for (i = 0; i<15; i++) {
		sum = sum + box[i];
	}
	a = sum%10;
	b = 10-a;
	c = b%10;
	if (c == box[15]) {
		cout<<"yes";
	}
	else {
		cout<<"no";
	}
}