Parking spaces on one floor
Statement
In a newly built building, each floor of the underground parking garage is split into several zones. Pillars and driveways make it impossible to use a whole floor as one piece, so the floor is used in separate zones. Let A be the number of zones on one floor.
The zones are all designed in the same shape, so each zone holds the same B parking spaces. No zone has more spaces than another, and none has fewer. Instead of leafing through the drawings and counting the zones one by one, the designer wants to know how many parking spaces a floor holds in all from the number of zones and the number of spaces in one zone alone.
Write a program that prints the number of parking spaces on one floor when the number of zones and the number of spaces in one zone are given.
For example, suppose one floor has 6 zones and each zone holds 7 spaces. The number of spaces in each zone is then as in the following table.
| Zone | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| Spaces | 7 | 7 | 7 | 7 | 7 | 7 |
Reading the drawing from the left and adding the zones one at a time, the running number of spaces grows as in the following table.
| Zone | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| Running number of spaces | 7 | 14 | 21 | 28 | 35 | 42 |
7 goes in six times, so the floor holds 42 spaces. So the answer in this case is 42.
Putting the results for other designs into one table gives the following.
| Number of zones | Spaces in one zone | Spaces on one floor |
|---|---|---|
| 6 | 7 | 42 |
| 1 | 2 | 2 |
| 9 | 9 | 81 |
There can also be a floor with only one zone. The number of spaces on such a floor is the same as the number of spaces in that zone.
Input and output examples
Example 1
Input
6 7
Output
42
Example 2
Input
1 2
Output
2
Example 3
Input
9 9
Output
81
Input
First the number of zones A and the number of spaces in one zone B are given on the first line, in that order, separated by one space. A and B are each natural numbers from 1 to 9. Every zone holds the same number of spaces, so the number of spaces per zone is not given separately. The two numbers can be equal, and a case with only one zone can also be given. This one line is the only line of input, and values such as the number of floors or the height of the building are not given.
Output
Print the number of parking spaces on one floor on the first line, as a natural number. Print the single number and then break the line, and do not attach a space after the number. Do not write a unit, print only the number.
Requirements
- The input is one line, and it holds two numbers separated by one space
- A and B are each natural numbers from 1 to 9
- Every zone holds the same number of spaces
- The answer is a single number and it is printed on one line
- 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.
- The output has to match the expected value down to the character. A space inside a line counts the same as any other character.
- There are 15 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 15 cases to solve this.
Examples
3 public cases. Judging also uses hidden cases. You have to pass all 15 cases to solve this.
1 2
2
9 9
81
6 7
42
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.
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
The time shown is the time spent solving. Input reading time is outside the solver's control, so it is excluded. And since each device reports this value itself, we record which device measured it.
Log in and you can see the code once you solve this problem.
Log in and you can see the code once you solve this problem.