📄 toj_2923.cpp
字号:
/*2923. Kangaroo Time Limit: 1.0 Seconds Memory Limit: 65536KTotal Runs: 3 Accepted Runs: 3Recently 2 kangaroos have been brought to CUET (06 CSE batch has no idea about it!).The kangaroos have been brought to play a new game. The game is described below.But before that we need to know that the kangaroos have an interesting property: they can jump once a second in one of two directions and cross 1 meter in each jump.A grid is drawn on the badminton court of CUET. The grid can be made as large as possible by using Harry Potter's magic wand (one of us has stolen it from Harry Potter!). Each of the 4 adjacent vertices of a vertex is exactly one meter apart. A vertex is the intersection of two lines. The above grid is a 6*6 grid.One of the kangaroos start from (0, 0) and the other start from (m-1, n-1) (in the above picture m=6, n=6).m and n both are Natural Numbers. The first kangaroo can jump in only the right or up direction while the second one can move only left or down direction. Given the values of m and n, you have to figure out whether the kangaroos will meet on a vertex or not, assuming that the kangaroos can stay on each vertex one second, it doesn't take any time to jump, both jump at the same moment and both always stay on vertex whose coordinates are natural numbers.InputThe first line of input contains an integer denoting the number of test cases. Each test case contains two numbers m and n. The numbers can be 100 digits long.OutputFor each test case output MEET if the kangaroos can meet and CANNOT if they cannot meet in a single line.Sample Input35 560 1207 12Sample OutputMEETMEETCANNOTProblem setter: CUET FRONTIERSSource: CUET individual contest*/#include<cstdio>#include<cstring>int main(){ int n , i; char num1[ 200 ] , num2[ 200] , digit1, digit2 , temp; scanf( "%d%*c" , &n ); for ( i = 0; i < n;i ++ ) { /* temp = getchar(); while ( temp != ' ' ) { digit1 = temp; temp = getchar(); } temp = getchar(); while ( temp != '\n' ) { digit2 = temp; temp = getchar(); }*/ scanf( "%s%s" , num1 , num2 ); digit1 = num1[ strlen( num1 ) - 1 ]; digit2 = num2[ strlen( num2 ) - 1 ]; if ( ( digit1 + digit2 ) % 2 == 0 ) printf( "MEET\n" ); else printf( "CANNOT\n" ); } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -