Slots the items go into
Statement
A logistics warehouse has a conveyor that runs in a loop. The conveyor carries 42 slots, numbered 0 through 41. The slot after slot 41 is slot 0 again.
Every item that comes into the warehouse has a tracking number written on it. When an item is placed on the conveyor, the remainder of its tracking number divided by 42 is worked out, and the item goes into the slot whose number equals that remainder. The remainder is always between 0 and 41, so whatever the tracking number is, exactly one slot is decided for it. Several items may go into one slot.
The warehouse manager wants to know how many slots were used today. Even if two items went into the same slot, that slot counts as one.
Ten items came into the warehouse today. Given the tracking numbers of the 10 items, write a program that prints how many different slots the items go into.
For example, suppose the tracking numbers of the 10 items are as in the table below. The remainder of each number divided by 42, which is the number of the slot the item goes into, is written alongside.
| Item | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| Tracking number | 1 | 43 | 2 | 44 | 3 | 45 | 4 | 46 | 5 | 47 |
| Slot it goes into | 1 | 1 | 2 | 2 | 3 | 3 | 4 | 4 | 5 | 5 |
Tracking numbers 1 and 43 both leave a remainder of 1 when divided by 42, so they go into the same slot. Tracking numbers 2 and 44 both leave a remainder of 2, so they also go into the same slot. In this way the ten items are split two at a time across five slots.
| Slot used | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| Items in it | 2 | 2 | 2 | 2 | 2 |
So 5 different slots are used, and the answer for this example is 5. If all ten items leave the same remainder, the answer is 1, and if they all leave different remainders, the answer is 10.
Input and Output Examples
Example 1
Input
1 43 2 44 3 45 4 46 5 47
Output
5
Example 2
Input
0 0 0 0 0 0 0 0 0 0
Output
1
Example 3
Input
7 7 7 7 49 49 49 91 91 133
Output
1
Input
First, the tracking number of the first item is given on the first line. Next, from the second line to the tenth line, the tracking numbers of the second item through the tenth item are given one per line, in order. So the input always consists of ten lines, and the number of items is not given separately. Each tracking number is an integer between 0 and 1,000. The same tracking number may appear several times.
Output
Print on one line how many different slots the items go into. Write one number and break the line. Do not attach any other character or space before or after it.
Requirements
- Read the input from standard input and write the answer to standard output
- The input is always ten lines, with one number on each line
- Even if several items go into the same slot, that slot counts as one
- The output is one number and a line break, nothing more. Printing explanatory words along with it gives a wrong answer
- 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 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.
0 0 0 0 0 0 0 0 0 0
1
1 43 2 44 3 45 4 46 5 47
5
7 7 7 7 49 49 49 91 91 133
1
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.