b594. A Marvelous Pet
標籤 :
通過比率 : 328人/379人 ( 87% ) [非即時]
評分方式:
Tolerant

最近更新 : 2015-10-06 08:08

內容

A marvelous pet, Mark, has a special eating habit. Mark only eats the thing that is lager than the last thing he ate and the sizes of the two things just have a diference of 1. For example, if Mark ate a thing in size k, he only eats the thing in size k + 1 next time.

Suppose Mark needs to eat at least two things. Mark needs to eat the things whose total sizes is equal to n. We note that Mark can only eat the thing whose size is less than n. Suppose that the pet owner, Alice, has n - 1 things whose sizes are from 1 to n - 1. All sizes are integers. Alice wants to know how many possible ways to feed Mark. Write a program to help Alice find the answer.

輸入說明

The input contains several test cases. Each test case contains one line. The line contains one integer which denotes the number n. The value of n is between 3 and 1000000.

The last line of input is only one 0 indicating the end of input.

輸出說明

For each input data, print how many possible ways that Alice may feed Mark.

範例輸入 #1
3
4
5
9
25 
0
範例輸出 #1
1
0
1
2
2
測資資訊:
記憶體限制: 64 MB
提示 :
標籤:
出處:
[管理者: spocktsai (囧rz) ]

本題狀況 本題討論 排行

編號 身分 題目 主題 人氣 發表日期
26882 cges30901 (cges30901) b594
等差數列公式
770 2021-08-30 15:37
41746 s210367@stud ... (張少謙) b594
醬子優化
56 2024-08-22 21:12
40640 qerpzzea@gma ... (賽希爾 cecill(陳宥穎)) b594
121 2024-06-03 18:42
28212 41075001H (茶トラ猫) b594
658 2021-11-18 19:31
16329 freedom50199 ... (帥氣魔方生) b594
觀念 by C
1486 2018-12-19 14:18