Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Three cats named A, B and C and three mice are standing at some points on a line. Cats A and IB are standing at

image text in transcribed
Three cats named A, B and C and three mice are standing at some points on a line. Cats A and IB are standing at point x and cat C is standing at point y. The three mice are hiding at a point z. The cats run at the same speed, and they want to catch one of the three mice in every run If cats A and B arrive at point z first, each cat catches one mouse and the other mouse escapes. If cat C arrives first at point z, it catches one of the mice and the other two mice escape; cats A and B catch none. If all cats arrive at the same time, each cat catches one mouse. You are given a number of test cases (cat runs) and the locations of the cats and mice. Find the number of mice each cat catches. Input Format Number of test cases followed by as many lines each has three consecutive integers containing x (location of cats A and B), y (location of cat C), and z (location of the three mice). Test cases Sample Input 3 1 23 132 2 1 Sample Output Cat A: 2 Cat B: 2 Cat C: 2 Instructions d run a C++ program to solve the problem using the input data below. Provide on the back of this sheet: (1) the C++ program, and (2) the output. Show your complete code and output on the back page. Demonstration of the program developed to your instructor before leaving is required 22 75 70 33 86 59 47 29 89 18 19 82 84 17 18 84 68 76 Three cats named A, B and C and three mice are standing at some points on a line. Cats A and IB are standing at point x and cat C is standing at point y. The three mice are hiding at a point z. The cats run at the same speed, and they want to catch one of the three mice in every run If cats A and B arrive at point z first, each cat catches one mouse and the other mouse escapes. If cat C arrives first at point z, it catches one of the mice and the other two mice escape; cats A and B catch none. If all cats arrive at the same time, each cat catches one mouse. You are given a number of test cases (cat runs) and the locations of the cats and mice. Find the number of mice each cat catches. Input Format Number of test cases followed by as many lines each has three consecutive integers containing x (location of cats A and B), y (location of cat C), and z (location of the three mice). Test cases Sample Input 3 1 23 132 2 1 Sample Output Cat A: 2 Cat B: 2 Cat C: 2 Instructions d run a C++ program to solve the problem using the input data below. Provide on the back of this sheet: (1) the C++ program, and (2) the output. Show your complete code and output on the back page. Demonstration of the program developed to your instructor before leaving is required 22 75 70 33 86 59 47 29 89 18 19 82 84 17 18 84 68 76

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

Describe in your own words what the p-value measures.

Answered: 1 week ago