Pro.ID22689 TitleDo solve it directly Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22689 AC0 Submit0 Ratio- 时间&空间限制描述The Imagine Cup Algorithm Semifinals are in the form of a game called Herbert. Herbert requires you to solve a series of levels by writing small programs to control a robot. Herbert is programmed in a simple but powerful language called "h". "h" contains elements of traditional high-level languages: statements, procedures, parameters, arguments, and recursion. However, "h" is syntactically simpler, and contains some concepts (procedural arguments) that are not found in traditional languages. Here are the basic elements of "h": A player, named mathmike did a really good job. He invented a funny function z(A, B) to represent an instruction sequence. This function is very efficient. Definition of it is described here: z(A, B) = sz(A-B, B)rz(B-A, A) The Herbert is initially placed at (0,0), and faces to (0,1). If A=2, B=3 then the Herbert will execute the following instructions: "srsrsr". In the end, the Herbert will locate at (1,0). 输入The first line of the input is a positive integer C, denoting the number of test cases followed. The input of each test case is two non-negative integers A and B ( 0 ≤ A, B ≤ 10000 ). 输出Description The Imagine Cup Algorithm Semifinals are in the form of a game called Herbert. Herbert requires you to solve a series of levels by writing small programs to control a robot. Herbert is programmed in a simple but powerful language called "h". "h" contains elements of traditional high-level languages: statements, procedures, parameters, arguments, and recursion. However, "h" is syntactically simpler, and contains some concepts (procedural arguments) that are not found in traditional languages. Here are the basic elements of "h": A player, named mathmike did a really good job. He invented a funny function z(A, B) to represent an instruction sequence. This function is very efficient. Definition of it is described here: z(A, B) = sz(A-B, B)rz(B-A, A) The Herbert is initially placed at (0,0), and faces to (0,1). If A=2, B=3 then the Herbert will execute the following instructions: "srsrsr". In the end, the Herbert will locate at (1,0). Input The first line of the input is a positive integer C, denoting the number of test cases followed. The input of each test case is two non-negative integers A and B ( 0 ≤ A, B ≤ 10000 ). Output The output should consist of C lines, one line for each test case, only containing two integers X and Y, which represent the final coordinates of the Herbert. No redundant spaces are needed. Sample Input 1 Sample Output 1 0 Source 样例输入1 样例输出1 0 作者 |