Submission

Status:

[PPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: kkxkkx001

Problemset: บาร์โค้ด

Language: cpp

Time: 0.003 second

Submitted On: 2026-10-02 14:20:16

#include <iostream>
#include <string>
using namespace std;

int main()
{
	string barcode="";
	cin >> barcode;
//	cout << barcode;
	int even=0;
	int odd=0;
		
	for (int i=0; i<12; i++) {
		int temp=0;
		temp=barcode[i]-'0';
//		cout << temp << endl;
		if (i%2==1)
		{
			odd+=temp;
		}
		else 
		{
			even+=temp;
		}
	}
		
	odd*=3;
//	cout << even<< endl;
//	cout << odd<< endl;
	int check = odd+even+(barcode[12]-'0');
	
	if ((check)%10==0)
	{
		cout << "YES";
	}
	else 
	{
		cout << "NO";
	}
}