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

L. Weather Report

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
Unrated 레이팅 미적용
난이도
2s
시간 제한
1024MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

You have been hired by the Association for Climatological Measurement, a scientific organization interested in tracking global weather trends over a long period of time. Of course, this is no easy task. They have deployed many small devices around the world, designed to take periodic measurements of the local weather conditions. These are cheap devices with somewhat restricted capabilities. Every day they \(ob- se\)rve which of the four standard kinds of weather occurred: Sunny, Cloudy, Rainy, or Frogs. After every \(n\) of these \(ob- se\)rvations have been made, the results are reported to the main server for analysis. However, the massive number of devices has caused the available communication bandwidth to be overloaded. The Association needs your help to come up with a method of compressing these reports into fewer bits. For a particular device’s location, you may assume that the weather each day is an independent random event, and you are given the predicted probabilities of the four possible weather types. Each of the \(4^{n}\) possible weather reports for a device must be encoded as a unique sequence of bits, such that no sequence is a prefix of any other sequence (an important property, or else the server would not know when each sequence ends). The goal is to use an encoding that minimizes the expected number of transmitted bits.

제약
입력 형식

The first line of input contains an integer \(1 \le n \le 20\), the number of observations that go into each report. The second line contains four positive floati\(ng-po\)int numbers, \(p\)sunny, \(p_{cloudy}\), \(p_{rainy}\), and \(p_{frogs}\), representing the respective weather probabilities. These probabilities have at most 6 digits after the decimal point and sum to 1.

출력 형식

Display the minimum expected number of bits in the encoding of a report, with an absolute or relative error of at most \(10^{−}^{4}\).

예제 1
입력
2
0.9 0.049999 0.05 0.000001
출력
1.457510
예제 2
입력
20
0.25 0.25 0.25 0.25
출력
40.000000
문제 정보

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

출처 ICPC World Finals 2015

평가 및 의견

L. Weather Report

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

Log in to rate problems.

개별 의견

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

풀이 제출

L. Weather Report

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