There is a cricket match going on between two teams 𝐴A and 𝐵B.Team 𝐵B is batting second and got a target of 𝑋X runs. Currently, team 𝐵B has scored 𝑌Y runs. Determine how many more runs Team 𝐵B should score to win the match.Note: The target score in cricket matches is one more than the number of runs scored by the team that batted first.Input FormatThe first line of input will contain a single integer 𝑇T, denoting the number of test cases.Each test case consists of two space-separated integers 𝑋X and 𝑌Y, the target for team 𝐵B and the current score of team 𝐵B respectively.Output FormatFor each test case, output how many more runs team 𝐵B should score to win the match.Constraints1≤𝑇≤101≤T≤1050≤𝑌<𝑋≤20050≤Y<X≤200Sample 1:InputOutput4200 50100 99130 9753 511501332Explanation:Test case 11: The target is 200200 runs and team 𝐵B has already made 5050 runs. Thus, the team needs to make 200−50=150200−50=150 runs more, to win the match.Test case 22: The target is 100100 runs and team 𝐵B has already made 9999 runs. Thus, the team needs to make 100−99=1100−99=1 runs more, to win the match.Test case 33: The target is 130130 runs and team 𝐵B has already made 9797 runs. Thus, the team needs to make 130−97=33130−97=33 runs more, to win the match.Test case 44: The target is 5353 runs and team 𝐵B has already made 5151 runs. Thus, the team needs to make 53−51=253−51=2 runs more, to win the match.
Question
There is a cricket match going on between two teams 𝐴A and 𝐵B.Team 𝐵B is batting second and got a target of 𝑋X runs. Currently, team 𝐵B has scored 𝑌Y runs. Determine how many more runs Team 𝐵B should score to win the match.Note: The target score in cricket matches is one more than the number of runs scored by the team that batted first.Input FormatThe first line of input will contain a single integer 𝑇T, denoting the number of test cases.Each test case consists of two space-separated integers 𝑋X and 𝑌Y, the target for team 𝐵B and the current score of team 𝐵B respectively.Output FormatFor each test case, output how many more runs team 𝐵B should score to win the match.Constraints1≤𝑇≤101≤T≤1050≤𝑌<𝑋≤20050≤Y<X≤200Sample 1:InputOutput4200 50100 99130 9753 511501332Explanation:Test case 11: The target is 200200 runs and team 𝐵B has already made 5050 runs. Thus, the team needs to make 200−50=150200−50=150 runs more, to win the match.Test case 22: The target is 100100 runs and team 𝐵B has already made 9999 runs. Thus, the team needs to make 100−99=1100−99=1 runs more, to win the match.Test case 33: The target is 130130 runs and team 𝐵B has already made 9797 runs. Thus, the team needs to make 130−97=33130−97=33 runs more, to win the match.Test case 44: The target is 5353 runs and team 𝐵B has already made 5151 runs. Thus, the team needs to make 53−51=253−51=2 runs more, to win the match.
Solution
Entrada La primera línea de entrada contendrá un solo entero 𝑇, que denota el número de casos de prueba. Cada caso de prueba consiste en dos enteros separados por espacio 𝑋 y 𝑌, el objetivo para el equipo 𝐵 y la puntuación actual del equipo 𝐵 respectivamente.
Salida Para cada caso de prueba, imprime cuántas carreras más debe anotar el equipo 𝐵 para ganar el partido.
Restricciones 1≤𝑇≤10 0≤𝑌<𝑋≤200
Ejemplo 1: Entrada 4 200 50 100 99 130 97 53 51
Salida 150 1 33 2
Explicación: Caso de prueba 1: El objetivo es 200 carreras y el equipo 𝐵 ya ha hecho 50 carreras. Por lo tanto, el equipo necesita hacer 200−50=150 carreras más para ganar
Similar Questions
Cricket World Cup QualifierThe cricket World Cup has started in Chefland. There are many teams participating in the group stage matches. Any team that scores 1212 or more points in the group stage matches qualifies for the next stage.You know the score that a particular team has scored in the group stage matches. Determine if the team has qualified for the next stage or not.Input FormatThe first and only line of input consists of an integer 𝑋X denoting the total points scored by the given team in the group stage matches.Output FormatOutput Yes, if the team has qualified for the next stage, and No otherwise.You may print each character of the string in uppercase or lowercase (for example, the strings YES, yEs, yes, and yeS will all be treated as identical).Constraints1≤𝑋≤201≤X≤20Sample 1:InputOutput3NoExplanation:The team has not scored ≥12≥12 points. Hence it does not qualify.Sample 2:InputOutput17YesExplanation:The team has scored ≥12≥12 points. Hence it does qualify.
the opening batsman in the 9a s scored 156 runs total. If batsman 1 scored 7 times as many runs as batsman 2 and batsman 3 scored 15 less than batsman 1, determine the scores of the three batsman
Four friends want to attend a concert. Each ticket costs 𝑋X rupees.They have decided to go to the concert if and only if the total cost of the tickets does not exceed 10001000 rupees.Determine whether they will be going to the concert or not.Input FormatThe first line of input will contain a single integer 𝑇T, denoting the number of test cases.Each test case consists of a single integer 𝑋X, the cost of each ticket.Output FormatFor each test case, output YES if they will be going to the concert, NO otherwise.You can print each character in uppercase or lowercase. For example, the strings YES, yes, Yes, and yES, are all considered identical.Constraints1≤𝑇≤1001≤T≤1001≤𝑋≤10001≤X≤1000Sample 1:InputOutput41005002501000YESNOYESNOExplanation:Test case 11: The total cost of all tickets is 100⋅4=400100⋅4=400 which is ≤1000≤1000. Thus, they will go to the concert.Test case 22: The total cost of all tickets is 500⋅4=2000500⋅4=2000 which is >1000>1000. Thus, they will not go to the concert.Test case 33: The total cost of all tickets is 250⋅4=1000250⋅4=1000 which is ≤1000≤1000. Thus, they will go to the concert.Test case 44: The total cost of all tickets is 1000⋅4=40001000⋅4=4000 which is >1000>1000. Thus, they will not go to the concert.
Input format :The first line contains an integer 't' representing the number of test cases.Each test case consists of a single line with two space-separated integers 'x' and 'y', representing the scores of Sasha and Brenda, respectively, for a particular round.Output format :For each test case, the output prints the result of that round.If x is greater than y, the output prints "Sasha".If x is equal to y, the output prints "Tie".Otherwise, the output prints "Brenda"
In a classic chase, Tom is running after Jerry as Jerry has eaten Tom's favourite food.Jerry is running at a speed of 𝑋X metres per second while Tom is chasing him at a speed of 𝑌Y metres per second. Determine whether Tom will be able to catch Jerry.Note that initially Jerry is not at the same position as Tom.Input FormatThe first line of input will contain a single integer 𝑇T, denoting the number of test cases.Each test case consists of two space-separated integers 𝑋X and 𝑌Y — the speeds of Jerry and Tom respectively.Output FormatFor each test case, output on a new line, YES, if Tom will be able to catch Jerry. Otherwise, output NO.You can print each character in uppercase or lowercase. For example NO, no, No, and nO are all considered the same.Constraints1≤𝑇≤1001≤T≤1001≤𝑋,𝑌≤101≤X,Y≤10Sample 1:InputOutput42 34 11 13 5YESNONOYESExplanation:Test case 11: Jerry is running at the speed of 22 metres per second while Tom is chasing him at the speed of 33 metres per second. Since Jerry's speed is less than Tom's, Tom will eventually catch Jerry.Test case 22: Jerry is running at the speed of 44 metres per second while Tom is chasing him at the speed of 11 metres per second. Since Jerry's speed is higher than Tom's, Tom will never be able to catch Jerry.Test case 33: Jerry is running at the speed of 11 metre per second while Tom is chasing him at the speed of 11 metre per second. Since Jerry's speed is same as that of Tom's and both of them are not at the same position, Tom will never be able to catch Jerry.Test case 44: Jerry is running at the speed of 33 metres per second while Tom is chasing him at the speed of 55 metres per second. Since Jerry's speed is less than Tom's, Tom will eventually catch Jerry.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.