Submission

Status:

[P-SSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: jamesz

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

Language: cpp

Time: 0.005 second

Submitted On: 2026-09-24 19:20:25

#include<bits/stdc++.h>
using namespace std;
int a[40] = {0}; 
int main(){
	string card;
	cin>>card;
	char T = card[15];
	card[15] = 0;
	for(int i = 0; i<16; i++){
		int g = card[i];
		a[15-i] = g;
	}
	for(int i = 0; i<16; i+=2){
		a[i]*=2;
	}
	int Count;
	Count = 0;
	for(int i = 0; i<17; i++){
		if(a[i]/10 > 0){
			int RR = a[i];
			a[i] = a[i]%10;
			Count+=1;
		}
	}

	for(int i = 0; i<40; i++){
		Count+=a[i];
	}
	if((10-(Count % 10)) % 10 == 8 && T - '0' == 8){
		cout<<"yes";
	}
	else{
		cout<<"no";
	}
	
}