Two cats named and are standing at integral points on the x-axis. Cat is standing at point and cat is standing at point . Both cats run at the same speed, and they want to catch a mouse named that's hiding at integral point on the x-axis. Can you determine who will catch the mouse?
You are given queries in the form of , , and . For each query, print the appropriate answer on a new line:
- If cat catches the mouse first, print
Cat A
. - If cat catches the mouse first, print
Cat B
. - If both cats reach the mouse at the same time, print
Mouse C
as the two cats fight and mouse escapes.
Input Format
The first line contains a single integer, , denoting the number of queries.
Each of the subsequent lines contains three space-separated integers describing the respective values of (cat 's location), (cat 's location), and (mouse 's location).
Each of the subsequent lines contains three space-separated integers describing the respective values of (cat 's location), (cat 's location), and (mouse 's location).
Constraints
Output Format
On a new line for each query, print
Cat A
if cat catches the mouse first, Cat B
if cat catches the mouse first, or Mouse C
if the mouse escapes.
Sample Input 0
3
1 2 3
1 3 2
2 1 3
Sample Output 0
Cat B
Mouse C
Cat A
Explanation 0
Query 0: The positions of the cats and mouse are shown below:
Cat will catch the mouse first, so we print
Cat B
on a new line.
Query 1: In this query, cats and reach mouse at the exact same time:
Because the mouse escapes, we print
Mouse C
on a new line.Solution:
- #include <bits/stdc++.h>
- #define pb push_back
- using namespace std;
- typedef long long LL;
- const int S = 100003;
- const int MOD = 1e9+7;
- const double pi = 2 * acos (0.0);
- int _Int(){int x; scanf("%d", &x); return x;}
- LL _LLi(){LL x; scanf("%lld", &x); return x;}
- void pruts(){puts("-1");exit(EXIT_SUCCESS);}
- int dirX[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
- int dirY[] = { 0, 1, 0, -1, 1, -1, -1, 1 };
- int rX[] = { 1, 1, 2, 2, -1, -1, -2, -2 };
- int rY[] = { 2, -2, 1, -1, 2, -2, 1, -1 };
- template < class T > T tri_Area( T x1, T y1, T x2, T y2, T x3, T y3 ){ return abs( x1*( y2-y3 ) - y1*( x2-x3 ) + ( x2*y3-x3*y2 ) );};
- template < class T > T Distance( T x1, T y1, T x2, T y2 ){ return sqrt( ( x1-x2 ) * ( x1-x2 ) + ( y1-y2 ) * ( y1-y2 ) ); };
- template < class T > T bigMod( T n, T p, T m ){ if( p == 0 )return 1; if( p&1 )return ( n*bigMod( n, p-1, m ) )%m; T x = bigMod( n, p/2, m ); return ( x*x )%m; };
- int sset(int N, int pos){return N=N|(1<<pos);}
- bool check(int N, int pos){return (bool)(N&(1<<pos));}
- int reset(int N, int pos){return N=N&~(1<<pos);}
- /*******************###########################################********************
- ********************## MD. YA-SEEN ARAFAT(ThunderStroke) ##********************
- ********************## CSE, University of Asia Pacific ##********************
- ********************###########################################********************/
- void Love(){
- int q = _Int();
- while( q-- ){
- int a = _Int();
- int b = _Int();
- int c = _Int();
- int A = 0, B = 0, C = 0;
- if( abs( a-c ) > abs( b-c ) )B = 1;
- else if( abs( a-c ) < abs( b-c ) )A = 1;
- else C = 1;
- if( A )puts( "Cat A" );
- if( B )puts( "Cat B" );
- if( C )puts( "Mouse C" );
- }
- }
- int main(){
- #ifndef ONLINE_JUDGE
- // freopen("in.txt", "r", stdin);
- // freopen("n.txt", "w", stdout);
- #endif
- Love();
- return 0;
- }
No comments:
Post a Comment