95.9% (117/122)

51.0% (187/367)

# Description

European countries use a 12-digit code called European Article Number (EAN) for each product. Each EAN ends with a check digit, which is calculated by the following rules:

Add the second, fourth, sixth, eighth, tenth, and twelfth digits (as $a$).
Add the first, third, fifth, seventh, ninth, and eleventh digits (as $b$).
Multiply $a$ by $3$ and add it to $b$ (as $x$).
Subtract $1$ from $x$ ( as $y$).
Compute the remainder when $y$ is divided by $10$ (as $z$).
Substract $z$ from $9$.
Write a program that reads the first 12 digits of an EAN, and then displays the calculated check digit.

12 digits

1 digit

869148426000

8

# Problem Source

No. Testdata Range Score
1 0~3 100

# Testdata and Limits

No. Time Limit (ms) Memory Limit (KiB) Output Limit (KiB) Subtasks
0 1000 65536 65536 1
1 1000 65536 65536 1
2 1000 65536 65536 1
3 1000 65536 65536 1