Blackboard

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

요약
칠판에 적힌 정수를 잘게 쪼개어 가장 큰 조각이 가장 작은 조각의 1+k/100배 이하가 되도록 할 때 필요한 최소 분할 횟수를 구한다.
난이도

보통10점 중 7점

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

문제

You find yourself in a room with a blackboard that has nn positive integers written on it. You like it when things are organized, but this blackboard is one big mess: the numbers are all over the place, with a mix of very small and very large numbers.

To organize things, you will split the numbers into smaller numbers, one at a time, such that the total sum remains the same. Thus, in one operation, you can choose any value xx from the blackboard, erase it, and replace it with two positive real numbers yy and zz such that x=y+zx = y + z. Your goal is to ensure that the largest value on the blackboard is at most kk percent larger than the smallest value.

Figure B.1: Illustration of Sample Input 1. The 77 can be replaced by 2.42.4 and 4.64.6. The 4.64.6 can in turn be replaced by 2.62.6 and 22. Finally, the 55 can be replaced by 2.32.3 and 2.72.7. After that, the largest value (33) is 5050\\% larger than the smallest value (22).

Determine the minimum number of operations required to achieve this goal.

입력

The input consists of:

  • One line with two integers nn and kk (1≤n≤10,0001\leq n\leq 10\\,000, 0≤k≤1000\leq k\leq 100), the initial number of integers on the blackboard and the required percentage of maximal difference.
  • One line with nn integers aa (1≤a≤1091\leq a\leq 10^9), the initial integers on the blackboard.

출력

Output the minimum number of operations required to ensure that the largest value on the blackboard is at most kk percent larger than the smallest value.

예제2

  1. 예제 1

    입력
    4 50
    2 3 5 7
    
    예상 출력
    3
    
  2. 예제 2

    입력
    2 20
    7 4
    
    예상 출력
    1