QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 256 MB Puntuación total: 100

#12950. 整数房地产经纪人

Estadísticas

在 Flatland 最近发生的骚乱之后,领导者允许所有人购买著名的 Zero 街的房地产。现在,不仅高贵的多边形可以住在那里,五边形、正方形,甚至三角形也可以(当然,前提是他们买得起 Zero 街的房子)!

作为“整数房地产中介”(Integer Estate Agency)的一名员工,你负责街道的一侧。房屋编号从 Zero Square 之后开始。#1 号房紧邻广场,#2 号房紧邻 #1 号房,#3 号房紧邻 #2 号房,以此类推,一直延伸到无穷远处(据传,高贵的完美圆家族就住在那里)。#k 号房的价格恰好为 $k+1$ 枚硬币。没有 #0 号房,因为那是广场。

一位有前途的客户愿意花费恰好 $n$ 枚硬币,购买一连串连续的房屋作为公寓大楼。他有多少种选择?例如,如果他想花费 5 枚硬币,他可以购买 #1 号房和 #2 号房(花费 $2+3=5$),或者他也可以只购买 #4 号房(花费 $5$),所以他有两种选择。

输入格式

输入包含多个测试用例。每个测试用例由单独一行上的一个整数 $n$ ($1 \le n \le 1,000,000$) 组成,表示客户愿意花费的硬币数量。输入以一行单独的 0 结束。

输出格式

对于每位客户,输出他购买连续房屋且恰好花费 $n$ 枚硬币的方法数。每个数字占一行,不要包含空格。输出之间不要打印任何空行。

样例

输入 1

1
2
5
0

输出 1

0
1
2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.