아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Packing Biscuits

시간 제한1초메모리 제한1024 MB

요약
맛도가 2^i인 비스킷 개수가 주어질 때, x개의 봉지가 모두 같은 총 맛도 y가 되도록 담을 수 있는 y의 개수를 구한다.
난이도

보통10점 중 6점

유형
그리디, 수학
정답자
아직 제출이 없습니다

문제

Aunty Khong is organising a competition with xx participants, and wants to give each participant a bag of biscuits. There are kk different types of biscuits, numbered from 00 to k−1k-1. Each biscuit of type ii (0≤i≤k−10 \leq i \leq k-1) has a tastiness value of 2i2^i. Aunty Khong has a\[i]a\[i] (possibly zero) biscuits of type ii 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 ii in all the bags must not exceed a\[i]a\[i]. 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 yy exist, such that it is possible to pack xx bags of biscuits, each having total tastiness equal to yy.

제한

  • 1≤k≤601 \leq k \leq 60
  • 1≤q≤10001 \leq q \leq 1000
  • 1≤x≤10181 \leq x \leq 10^{18}
  • 0≤a\[i]≤10180 \leq a\[i] \leq 10^{18} (for all 0≤i≤k−10 \leq i \leq k-1)
  • For each call to count_tastiness, the sum of tastiness values of all biscuits in the pantry does not exceed 101810^{18}.

예제

이 문제는 공개된 예제가 없습니다.