传统题 1000ms 256MiB

ISBNs

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

problem

ISBN-13 codes are used to uniquely identify books. They are made of 12 digits that carry data and a thirteenth check digit which is used to check it is a valid ISBN number.

ISBN-13编码用于标识图书。它们由12位携带数据和13位校验数字组成,用于检查国际标准书号是否有效。

The algorithm required to check if an ISBN-13 number is valid is:

检查ISBN-13号是否有效的算法是:

Add the 1st, 3rd, 5th, 7th, 9th and 11th numbers. Call the sum of these odds.

把第 1、3、5、7、9、11号相加。计算这些奇数的总和。

Multiply the 2nd, 4th, 6th, 8th, 10th and 12th numbers by 3 and then add the products together. Call the answer to this step evens.

将第2、4、6、8、10、12个数分别乘以3,然后将它们相加。这一步的答案叫偶数。

Add odds to evens and then divide by 10. Store the remainder.

把奇数与偶数相加,然后除以10,保留余数。

If the remainder is 0 and the 13th digit (the check digit) is 0, then the ISBN-13 number is valid,

如果余数为0,第13位(校验位)为0,则ISBN-13号是有效的,

otherwise, to be valid, the check digit should be equal to 10 minus the remainder. 否则,要使ISBN-13有效,检查位数应该等于 10 减去余数。

Task

Write a program that creates the ISBN check digits. Your program should output the check digit as an integer when provided with the first 12 digits of what will be an ISBN-13 number.

任务:

编写一个可以产出ISBN 检查位数的程序。当提供了ISBN-13数字的前12位时,编写出的程序输出的检查位数应是一个整数。

Sample

978150840984
7

2020 OUCC

未参加
状态
已结束
规则
IOI
题目
8
开始于
2024-10-30 14:00
结束于
2024-10-30 16:00
持续时间
2 小时
主持人
参赛人数
2