编程介的小学生 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条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 MATLAB动图问题
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名