## CCC '09 J1 - ISBN

View as PDF

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
##### Canadian Computing Competition: 2009 Stage 1, Junior #1

The International Standard Book Number (ISBN) is a 13-digit code for identifying books. These numbers have a special property for detecting whether the number was written correctly.

The 1-3-sum of a 13-digit number is calculated by multiplying the digits alternately by 1's and 3's (see example) and then adding the results. For example, to compute the 1-3-sum of the number 9780921418948 we perform: The special property of an ISBN number is that its 1-3-sum is always a multiple of .

Write a program to compute the 1-3-sum of a 13-digit number. To reduce the amount of typing, you may assume that the first ten digits will always be 9780921418, like the example above. Your program should input the last three digits and then print its 1-3-sum. Use a format similar to the samples below.

#### Sample Input 1

9
4
8

#### Sample Output 1

The 1-3-sum is 120

#### Sample Input 2

0
5
2

#### Sample Output 2

The 1-3-sum is 108

• commented on Feb. 20, 2020, 9:03 p.m.

You have to write the full sentence

• commented on Aug. 25, 2018, 8:14 p.m.

Oh. I forgot the sentence.

• commented on July 31, 2018, 10:50 p.m. edited

Agreed! (Also remember that BRACKETS MATTER)!

• commented on Sept. 25, 2014, 9:43 p.m.

Note that your output must exactly be the same as specified.

The 1-3-sum is 120 is fine, but 120 is wrong, and The 1-3-sum is 120. (notice the period) is also wrong.