HELP PLEASE

jaa

Joined
Jul 19, 2022
Messages
4
Reaction score
0
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 player 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
 
Joined
May 11, 2022
Messages
60
Reaction score
6
Code:
score = int(input("how many points were scored? "))
if score < 22:
   print("-")
elif score < 32:
   print("11 0\n",11,score-22)
else:
   if score%2 == 0:
      score -= 12
      print("11 1\n", score//2 -1,score//2 +1)
   else:
      score-= 11
      print("11 0 \n",score//2 -1,score//2 +1)
 

jaa

Joined
Jul 19, 2022
Messages
4
Reaction score
0
Code:
score = int(input("how many points were scored? "))
if score < 22:
   print("-")
elif score < 32:
   print("11 0\n",11,score-22)
else:
   if score%2 == 0:
      score -= 12
      print("11 1\n", score//2 -1,score//2 +1)
   else:
      score-= 11
      print("11 0 \n",score//2 -1,score//2 +1)
hey, can you try to do it again because in the first example it writes 11 0 then 11 5 but it should 11 5 then 11 0 (look at the examples) and second line is indented and the third example isn't working? PLEASEEE HELP MEEE
 
Joined
May 11, 2022
Messages
60
Reaction score
6
Python:
score = int(input("how many points were scored? "))
if score < 22:
   print("-")
elif score < 32:
   print(11,score-22,"\n11 0")
else:
   if score%2 == 0:
      score -= 12
      print(score//2 -1,score//2 +1,"\n11 1")
   else:
      score-= 11
      print(score//2 -1,score//2 +1,"\n11 0")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,053
Messages
2,570,431
Members
47,075
Latest member
TysonV438

Latest Threads

Top