当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2856:Find Its Place

题目描述
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.
输入解释
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.
输出解释
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.
输入样例
3
1 2
3 3
10 5
输出样例
3 1
4 2
6 4
来自杭电HDUOJ的附加信息
Recommend gaojie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-2856

最后修改于 2020-10-25T22:57:32+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)