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

19268번 - Lazy Student 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB1033100.000%

문제

The Algorithms course exam is coming soon and there will be $k$ days when you can attempt to pass it. You can come on any subset of the days until you finally pass the exam. A young lazy student Raccoon definitely wants to pass the exam, but at the same time he wants to learn the smallest possible number of topics. It means that if there is only one exam day left, Raccoon will learn all the topics. On the other hand, if there are 10ドル$ attempts, he may hope that it is enough to learn just a third of all the topics.

Let's describe the process in more detail. Let all the topics be a segment $[0,1]$. Raccoon learns the first $x$ topics (which is a real number from 0ドル$ to 1ドル$). When Raccoon comes to an exam-day, he will pass with probability $x$. Raccoon may learn any amount of topics before exams or in-between until he passes the exam. He never forgets what he already has learned. For example, Raccoon may learn $\frac{1}{3}$ before the first exam day and up-learn $\frac{1}{6}$ after a failure which will make a total of $\frac{1}{2}$ learned topics. If Raccoon fails on all the days before the last one, he will make sure that he will know all the topics before the last attempt (he definitely wants to pass the exam, remember?).

Raccoon is lazy and doesn't want to learn a lot of topics. He is going to choose a strategy that will provide him with the least expected amount of topics that he needs to learn. What is this expected amount?

입력

The input contains a single integer $k$: the number of attempts to pass the exam (1ドル \le k \le 10^{18}$).

출력

The answer can be represented as an irreducible fraction $\frac{P}{Q}$. You are asked to output $P \bmod M$ and $Q \bmod M$ separated by a space, where $M = 1,000円,000円,007円$.

제한

예제 입력 1

2

예제 출력 1

3 4

예제 입력 2

3

예제 출력 2

39 64

힌트

For the first input (when there are just 2ドル$ exam-days) Raccoon may learn $\frac{1}{2}$ of all topics before the first attempt and another $\frac{1}{2}$ if he fails on the first day. The expected amount of topics to be learned is therefore $\frac{1}{2} \cdot \frac{1}{2} + \frac{1}{2} \cdot 1 = \frac{3}{4}$.

출처

Camp > Petrozavodsk Programming Camp > Winter 2018 > Day 2: ITMO U 1 Contest L번

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

출처

대학교 대회

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

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