Store credit from a draw
Statement
A draw machine stands in front of a stationery shop. One draw rolls out three balls in order, and each ball has one of the numbers from 1 to 6 written on it. Two different balls can carry the same number.
The shop owner reads the three numbers that rolled out and gives the customer store credit. The rule for the credit is as in the following table.
| Case | Store credit |
|---|---|
| All three numbers the same | 10,000 + (the shared number) × 1,000 won |
| Only two numbers the same | 1,000 + (the shared number) × 100 won |
| All three numbers different | (the largest number) × 100 won |
When only two numbers are the same, you have to work out which two balls carry the same number. The first and the second can be the same, the first and the third can be the same, or the second and the third can be the same. In all three cases you have to find the shared number and put it into the rule.
Write a program that prints the store credit the customer receives when the numbers written on the three balls are given.
For example, suppose the numbers on the balls are 3, 3 and 6 in that order. The following table shows the steps for working out which case applies.
| Step | Content |
|---|---|
| Numbers on the balls | 3, 3, 6 |
| Are all three numbers the same | No |
| Are only two numbers the same | Yes. The first and the second are both 3 |
| Rule used | 1,000 + (the shared number) × 100 won |
| Store credit | 1300 |
So the store credit in this case is 1,300 won.
Putting the results of other draws into one table gives the following.
| Numbers on the balls | 3, 3, 6 | 2, 2, 2 | 1, 2, 3 | 5, 1, 5 | 2, 6, 6 |
|---|---|---|---|---|---|
| Case that applies | Only two the same | All three the same | All different | Only two the same | Only two the same |
| Store credit | 1300 | 12000 | 300 | 1500 | 1600 |
In 5, 1, 5 the first and the third are the same, and in 2, 6, 6 the second and the third are the same.
Input and output examples
Example 1
Input
3 3 6
Output
1300
Example 2
Input
2 2 2
Output
12000
Example 3
Input
1 2 3
Output
300
Input
First the numbers written on the three balls are given on the first line, in the order the balls rolled out, separated by one space. Each number is an integer from 1 to 6. The three numbers come in the order the balls rolled out, and the same number can be mixed in among them. A case with all three the same, a case with only two the same and a case with all three different can all come in, and the numbers are not sorted for you. This one line is the only line of input, and the space between the numbers is a single space.
Output
Print the store credit the customer receives on the first line, as a natural number. Do not write the won unit, print only the number, and do not print a thousands comma either. For 1,300 won you print 1300. Print the single number and then break the line, and do not attach a space after the number.
Requirements
- The input is one line, and it holds three numbers separated by one space
- Each number is an integer from 1 to 6
- When only two numbers are the same, you have to check every pair of balls that could match
- Print the credit as the number alone, with no unit and no thousands comma
- 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.
3 3 6
1300
2 2 2
12000
1 2 3
300
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.