• 검색 결과가 없습니다.

Packing Biscuits (biscuits)

N/A
N/A
Protected

Academic year: 2022

Share "Packing Biscuits (biscuits)"

Copied!
3
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

Packing Biscuits (biscuits)

Aunty Khong is organising a competition with participants, and wants to give each participant a bag of biscuits. There are different types of biscuits, numbered from to . Each biscuit of type ( ) has a tastiness value of . Aunty Khong has (possibly zero) biscuits of type in her pantry.

Each of Aunty Khong's bags will contain zero or more biscuits of each type. The total number of biscuits of type in all the bags must not exceed . The sum of tastiness values of all biscuits in a bag is called the total tastiness of the bag.

Help Aunty Khong find out how many different values of exist, such that it is possible to pack bags of biscuits, each having total tastiness equal to .

Implementation Details

You should implement the following procedure:

​int64 count_tastiness(int64 x, int64[] a)​

: the number of bags of biscuits to pack.

: an array of length . For , denotes the number of biscuits of type in the pantry.

The procedure should return the number of different values of , such that Aunty can pack bags of biscuits, each one having a total tastiness of .

The procedure is called a total of times (see Constraints and Subtasks sections for the allowed values of ). Each of these calls should be treated as a separate scenario.

Examples

Example 1

Consider the following call:

​count_tastiness(3, [5, 2, 1])​

This means that Aunty wants to pack bags, and there are types of biscuits in the pantry:

biscuits of type , each having a tastiness value ,

Biscuits (1 of 3)

(2)

biscuits of type , each having a tastiness value , biscuit of type , having a tastiness value .

The possible values of are . For instance, in order to pack bags of total tastiness , Aunty can pack:

one bag containing three biscuits of type , and

two bags, each containing one biscuit of type and one biscuit of type . Since there are possible values of , the procedure should return .

Example 2

Consider the following call:

​count_tastiness(2, [2, 1, 2])​

This means that Aunty wants to pack bags, and there are types of biscuits in the pantry:

biscuits of type , each having a tastiness value , biscuit of type , having a tastiness value , biscuits of type , each having a tastiness value .

The possible values of are . Since there are possible values of , the procedure should return .

Constraints

(for all )

Biscuits (2 of 3)

(3)

For each call to count_tastiness, the sum of tastiness values of all biscuits in the pantry does not exceed .

Subtasks

1. (9 points) , and for each call to count_tastiness, the sum of tastiness values of all biscuits in the pantry does not exceed .

2. (12 points) , 3. (21 points) ,

4. (35 points) The correct return value of each call to count_tastiness does not exceed .

5. (23 points) No additional constraints.

Sample grader

The sample grader reads the input in the following format. The first line contains an integer . After that, pairs of lines follow, and each pair describes a single scenario in the following format:

line : line :

The output of the sample grader is in the following format:

line ( ): return value of count_tastiness for the -th scenario in the input.

Biscuits (3 of 3)

참조

관련 문서

I would like to suggest to have more focused discussions on some bottlenecked issues that we have different views.. In my

External trading partners know the reality that ASEAN is not a common market, making it easier for countries such as the US to pull out of the

It is reported that gender sensitivity is changed based on understanding of a gendered society and empathy with others while having sensitivity to differences

I’d like to make small pots out of plastic cups or bottles and many pieces of colored paper.. Each cup or bottle should be large enough to grow

5 해설 학교에 청소해 주는 사람들이 있어야 한다고 생각한다 는 A 의 말에 B 가 빈칸 뒤에서 우리가 교실을 사용하니 우리 가 교실을 청소해야 한다고 말하고

Having different styles of investment (style investment) is necessary in order to propel customized asset management services that utilize MSA in the

Choose the Language after “Sign Up” at application homepage.. Choose the course (Undergraduate or Post-graduate) and

Although there exist various different types of business associations in terms of their legal establishment, those groups that were delegated to carry out