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

建议使用的浏览器:

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

2853:Sequence Sum Possibilities

题目描述

Most positive integers may be written as a sum of a sequence of at least two consecutive positive integers. For instance,

6 = 1 + 2 + 3
9 = 5 + 4 = 2 + 3 + 4
but 8 cannot be so written.

Write a program which will compute how many different ways an input number may be written as a sum of a sequence of at least two consecutive positive integers.

输入解释

The first line of input will contain the number of problem instances N on a line by itself, (1 N 1000) . This will be followed by N lines, one for each problem instance. Each problem line will have the problem number, a single space and the number to be written as a sequence of consecutive positive integers. The second number will be less than 231 (so will fit in a 32-bit integer).

输出解释

The output for each problem instance will be a single line containing the problem number, a single space and the number of ways the input number can be written as a sequence of consecutive positive integers.

输入样例
7
1 6
2 9
3 8
4 1800
5 987654321
6 987654323
7 987654325
输出样例
1 1
2 2
3 0
4 8
5 17
6 1
7 23

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Greater New York 2005

源链接: POJ-2853

最后修改于 2020-10-29T06:45:55+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536