Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

Python HELP PLEASE

Mike didn't get to watch the table tennis match, but he heard that the match ended in two sets and that it was played in total n points. Mike knows that in table tennis each set is played up to 11 with a difference of two points. So for example, a set can end with any of the scores 11:0, 11:1, 11:7, 11:9, 12:10, 27:25 and cannot end with any of the scores 4:0, 11:10, 14:11.
Now Mike is trying to determine the score by sets, a1:b1, a2:b2, where the player is A (first player) won both sets, and the sum of the points in the second set a2+b2 is the smallest possible for a given total number of points n.

Input
The first and only line of standard input is an unsigned integer n, less than 1000.
Output
Write the result of the first set in the first line, and the result of the second set in the second line. Represent the result of each set with two integers separated by a space. The first number in the row represents the number of points won by the first player in that set, and the second number is the number of points scored by the second player. If the total number of points played cannot be equal to the given number n, write the - (minus) sign.

Example 1
Input
27
Output
11 5
11 0

Example 2
Input
21
Output
-

Example 3
Input
38
Output
14 12
11 1
 
Now Mike is trying to determine the score by sets, a1:b1, a2:b2, where the player is A (first player) won both sets, and the sum of the points in the second set a2+b2 is the smallest possible for a given total number of points n.
I don't really understand this sentence. Could you explain it a bit more. 🙂
 
Johna said:
I don't really understand this sentence. Could you explain it a bit more.
@Johna, finding it hard to understand myself, but from what I can gather:
  • We have two sets, A1:B1 and A2:B2 - we are focusing solely on the sets of Player A, who won both sets.
  • We are trying to deduct the score(variable: n) from these two sets for Player A.
  • And from what I can interpret: the sum of the points in the second set is the smallest possible total number of points(?)

I don't know if that helps, so please let me know. Questions like these where many will find it hard to understand at first are designed to trip us up - the only way to understand them is to read them closely and look over how they're worded(I've probably been tripped up too without realising it).
 

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom