编程介的小学生 2017-11-23 16:33 采纳率: 20.5%
浏览 863
已采纳

Find Its Place

Problem Description
Have you seen the National Day military review? That’s very grand!
And now, ALPCs have received a arduous mission——taking a parade at August first.
The traditional order is rectangular, but ALPCs want to make a innovation. They start to research a new triangular order called Yang Hui’s triangle.
Yang Hui’s triangle is known to all:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
In it the ends of each line is 1, and every other number in each line equals to the sum of the two numbers on the shoulders. It’s obvious that it’s a piece of cake (especially with the help of computer)for us to get value of the C-th number in line R, therefore our problem goes to the opposite: given two Continuous numbers in a same line, please find out their positions in this huge triangle.

Input
The first line of the input is a N indicating the test cases number.
Then follow N lines. Each line includes two positive integers: a, b, and a, b < 2^63. The number a should be aligned on the left of the number b. It’s certain that for every data input there is always a solution.

Output
For each testing data there will be only one line out: R C. which means the C-th number on line R. What’s more, R and C should be separated by a blank space. For multiple solutions, please print out the solution with the minimum R.

Sample Input
3
1 2
3 3
10 5

Sample Output
3 1
4 2
6 4

  • 写回答

2条回答 默认 最新

  • threenewbee 2018-05-30 15:46
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样