RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00388

Krumpirko

Unrated 레이팅 미적용
난이도
1s
시간 제한
64MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(6^{th}\) round, February \(6^{th}\) 2016
Young Mr. Potato is opening two new stores where he will, you guessed it, sell potatoes. Mr. Potato
gets his potatoes from \(N\) farmers. Each farmer offers exactly \(a@@RISE_MATH_BLOCK_0@@i\). Mr. Potato is going to buy all bags of potatoes from all farmers and place the bags in his two
stores.
Let’s denote the average potato price in the first store with \(P\)1, and the average potato price in the
second store with \(P_{2}\). The average potato price in a store is equal to the ratio of the price and the
total number of potatoes in the store. Taking into account logistical difficulties and the amount
of potatoes in the stores, he wants the product of the average prices of potatoes in the stores to be
minimal. In other words, he wants the product of \(P\)1 and \(P\)2 to be minimal.
After Mr. Potato settles on a division of bags in the stores, at least one store must have exactly \(L\)
bags.

제약

In at least 30% of examples, it will hold \(N\) ⩽20.

입력 형식

The first line of input contains two integers \(N\) and \(L\) (2 ⩽\(N\) ⩽100, 1 ⩽\(L < N\)), the number of
potato bags and the number of potato bags in at least one store.
The second line of input contains \(N\) integers \(a@@RISE_MATH_BLOCK_0@@i\) ⩽100), separated by space.
The third line of input contains \(N\) integers \(c@@RISE_MATH_BLOCK_1@@i\) ⩽1 000 000), separated by space.
The sum of all \(a\)\(i\) will be ⩽500.

출력 형식

The first and only line of output must contain the minimal product of \(P\)1 and \(P\)2 from the task, rounded
to three decimal places.

예제 1
입력
3 1
3 2 1
1 2 3
3 2
2 2 2
3 3 3
출력
output
0.556
2.250
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2015/2016 Contest 6

평가 및 의견

Krumpirko

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Krumpirko

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8