Logo
(追記) (追記ここまで)

33552번 - Excellent Grades 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB292533416.190%

문제

In order to receive his propedeutic degree cum laude, the weighted average of all of Eddie's grades must be at least 8.0. Of course he must also have passed all of his courses, which requires a grade of at least 5.8. With only one exam to go, Eddie is wondering if he still has a shot at achieving cum laude.

Given all of the grades for Eddie's previous courses and their weights, and the weight of the final exam, check if Eddie can still obtain his degree cum laude. If he can, output the grade Eddie requires for his final exam to achieve this. Otherwise output IMPOSSIBLE.

입력

  • A line with 1 integer $w_u$ $(1 \leq w_u \leq 30),ドル the weight of the final exam
  • A line with 1 integer $n$ $(1 \leq n \leq 100),ドル the number of other grades
  • $n$ lines with 1 double (1 decimal) $g_i$ $(1 \leq g_i \leq 10)$ and 1 integer $w_i$ $(1\leq w_i \leq 30)$ where $g$ is the grade of exam $i$ and $w_i$ is the weight of exam $i$.

출력

If Eddie can achieve cum laude, print the grade $g$ $(1 \leq g \leq 10)$ he has to achieve on his final exam, rounded to 1 decimal. Otherwise print IMPOSSIBLE.

제한

예제 입력 1

3
3
8.0 2
7.0 1
7.0 4

예제 출력 1

9.7

예제 입력 2

2
4
8.0 2
6.1 1
8.3 1
7.1 3

예제 출력 2

IMPOSSIBLE

힌트

출처

University > Delft University of Technology > Sjaars Kampioenschap Programmeren 2015 E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /