a557. NCPC PB Integer Partition
標籤 :
通過比率 : 39人/41人 ( 95% ) [非即時]
評分方式:
Tolerant

最近更新 : 2012-10-21 20:15

內容

Problem B

Integer Partition

Input File: pb.in

Time Limit: 5 seconds

 

        A new partition problem is defined as follows. Let the symbol Py,zi be the number of ways to write a positive integer y as a sum of i positive integers having the largest part no larger than z, i.e.,

y = a1+a2+…+ai, and z >= a1 >= a2 … >= ai >= 1

Notice that two sums differing only in the order of their summands are considered to be the same partition. For example, P25,4 = 2 (can be partitioned in two distinct ways: 4+1, 3+2) and P25,3­ = 1 (can be partitioned in one single way: 3+2).

        Please write a program to compute the number of Piy,z with given integers y, i, and z, which y may be as large as up to 500.

 

Technical Specification

1.    1 <= y <= 500

2.    1 <= i <= 50

3.    1 <= z <= 100

輸入說明

The first line of the input file contains one integer m(<= 5) indicating the number of test cases to following m lines, there are three integers y, i, and z.

輸出說明

For each test case, output Piy,z.

範例輸入 #1
5
20 4 7
100 50 51
487 18 87
492 19 89
500 19 90
範例輸出 #1
13
204226
7139824136004762
20430740394679891
25985433353057732
測資資訊:
記憶體限制: 512 MB
不公開 測資點#0 (100%): 5.0s , <1K
提示 :
標籤:
出處:
NCPC2012 [管理者: morris1028 (碼畜) ]

本題狀況 本題討論 排行

編號 身分 題目 主題 人氣 發表日期
沒有發現任何「解題報告」