Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: IKKIWPR

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

Language: cpp

Time: 0.003 second

Submitted On: 2026-10-09 15:23:26

#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;cin >> s;
	int sum = 0;
	int last = s[15] - '0';
	reverse(s.begin() , s.end());
	for (int i = 1;i<16;i++){
		if (i%2!=0)	{
			int n = (s[i] - '0')*2;
			n = n%10 + n/10;
			sum+=n;
		}
		else sum+=s[i] - '0';
	}
	if ((10 -(sum%10))%10==last) cout << "yes";
	else cout << "no";
}