Log inSign up
Problems / B009

Store credit from a draw

200 ptsCases 15Set by dongbinna
Added October 30.
2 solved2 attempted2 submissionssolvers took 1.0 tries on average

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.

CaseStore credit
All three numbers the same10,000 + (the shared number) × 1,000 won
Only two numbers the same1,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.

StepContent
Numbers on the balls3, 3, 6
Are all three numbers the sameNo
Are only two numbers the sameYes. The first and the second are both 3
Rule used1,000 + (the shared number) × 100 won
Store credit1300

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 balls3, 3, 62, 2, 21, 2, 35, 1, 52, 6, 6
Case that appliesOnly two the sameAll three the sameAll differentOnly two the sameOnly two the same
Store credit13001200030015001600

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.
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 15 cases to solve this.

Input
Expected output
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.

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

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.

1ostenhun19ms228 charsPythonWindows NT 10.0 / Chrome/154.0.0.0 / 12코어 / 32GB

Log in and you can see the code once you solve this problem.

2bampal228ms229 charsPythonWindows NT 10.0 / Chrome/156.0.0.0 / 8코어 / 16GB

Log in and you can see the code once you solve this problem.