Log inSign up
Problems / B011

Bundle quantity table

100 ptsCases 9Set by dongbinna
Added October 30.

Statement

A distribution warehouse keeps small parts tied up in bundles of a fixed count. One bundle holds N parts, and every bundle in the warehouse is the same. Parts are only taken out by the bundle, never by untying one.

The keeper of the warehouse finds it a nuisance to count the parts by hand every time a bundle is taken out. So the keeper wants to put a quantity table on the wall, written out in advance, giving the total number of parts for taking out 1 bundle up to taking out 9 bundles. This warehouse never takes out more than 9 bundles at a time, so the quantity table always has 9 lines.

One line of the quantity table is the following five pieces joined together with a space between them.

Piece12345
ContentParts in one bundleMultiplication signBundles taken outEquals signTotal number of parts

Write a program that prints the quantity table for the wall when the number of parts in one bundle N is given.

For example, suppose the parts are kept in bundles of N=5. The total number of parts for each number of bundles taken out is then as in the following table.

Bundles taken out123456789
Total number of parts51015202530354045

Writing the values of the table above one line at a time in the shape described earlier, the quantity table for the wall comes to the following 9 lines.

LineWhat is written
15 * 1 = 5
25 * 2 = 10
35 * 3 = 15
45 * 4 = 20
55 * 5 = 25
65 * 6 = 30
75 * 7 = 35
85 * 8 = 40
95 * 9 = 45

In a warehouse with N=1, one bundle holds only one part, so the quantity table reads from 1 * 1 = 1 down to 1 * 9 = 9 in order. A small N does not make the number of lines any smaller.

Input and output examples

Example 1

Input

5

Output

5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45

Example 2

Input

1

Output

1 * 1 = 1
1 * 2 = 2
1 * 3 = 3
1 * 4 = 4
1 * 5 = 5
1 * 6 = 6
1 * 7 = 7
1 * 8 = 8
1 * 9 = 9

Example 3

Input

9

Output

9 * 1 = 9
9 * 2 = 18
9 * 3 = 27
9 * 4 = 36
9 * 5 = 45
9 * 6 = 54
9 * 7 = 63
9 * 8 = 72
9 * 9 = 81

Input

  • First the number of parts in one bundle N is given on the first line. N is a natural number from 1 to 9. The input ends with this one line, and nothing at all is given from the second line on. The bundle counts to write in the quantity table are not given as input. The number of bundles taken out always runs from 1 to 9, so reading N alone is enough to write the whole quantity table.

Output

  • Print 9 lines. Line i holds the number of parts in i bundles, written in the form N * i = (the product of N and i). Put one space on each side of the multiplication sign and one space on each side of the equals sign. Leave no space at the end of a line, and break the line there. Do not attach one more blank line after the ninth and last line. When a line holds more than one value, the values are separated by a single space.

Requirements

  • Read the input from standard input and write the answer to standard output
  • The only number you have to read is N on the first line
  • The output is always 9 lines, whatever N is
  • The shape of each line is N * i = (product). It has to match down to where the spaces sit
  • Grading compares the output with the expected value down to the last character
  • You must write a program that reads from standard input and writes to standard output
  • Trailing spaces at the end of a line and blank lines at the end of the output are ignored when grading
  • The languages you can use are Python and JavaScript
  • The memory limit is 256MB. The browser does not measure it, it only states it
  • The time limit is set by measuring the setter's reference solution on the same runtime
  • On this problem you submit code, not a prompt. That code runs in the browser on this device, and all that goes to the server is a fingerprint of the output and the time it took. Whether it is correct is decided by the server. The run time is a number each device reports, so the code and the device details are posted next to it on the leaderboard.
  • There are 9 cases, and 3 of them show the input together with the expected output. The rest are used only when you submit and are not shown on this page.
  • You have to pass all 9 cases to solve this.
Read the requirements carefully before solving. Tampering with the grading to make a submission look like a pass can get you sanctioned if caught. The code you submit is published on the leaderboard along with the result.

Examples

3 public cases. Judging also uses hidden cases. You have to pass all 9 cases to solve this.

Input
Expected output
1
1 * 1 = 1
1 * 2 = 2
1 * 3 = 3
1 * 4 = 4
1 * 5 = 5
1 * 6 = 6
1 * 7 = 7
1 * 8 = 8
1 * 9 = 9
5
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
9
9 * 1 = 9
9 * 2 = 18
9 * 3 = 27
9 * 4 = 36
9 * 5 = 45
9 * 6 = 54
9 * 7 = 63
9 * 8 = 72
9 * 9 = 81

Solution

Your code runs on this device. Only the fingerprint of the output and the elapsed time go to the server. The server decides whether it is correct.

0 chars1 lineMemory 256MB (recorded only)Reference 2.0ms

Submitting requires you to log in. Running against the public cases works without one.

You can test with 3 public cases. Submitting runs the hidden cases too.

People who solved this problem

Nobody yet. You could be the first.