• [1382] Baby Please Don't Leave

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • There are three people(Cai, Minary and TT). Cai loves both Minary and TT. But, Cai is only one, so everyday he can only visit one people, just Minary or TT.
    Cai will visit Minary with the probability p(0 < p < 1), so he will visit TT with the probability (1 - p).
    He has n apples and n bananas. If he visits Minary, he will give Minary an apple. If he visits TT, he will give TT a banana.
    If he visits Minary without apple, Minary will leave Cai.
    or if he visits TT without banana, TT will leave Cai.
    Now, Cai wants to know the expected number of fruits left When one of them leave.
  • 输入
  • There are several test cases.
    For each test case, there is a single line containing an integer n (1 <= n <= 2 × 10^5) and a real number p (0 < p < 1, with 5 digits after the decimal).
  • 输出
  • For each test case, output one line “Case X: Y” where X is the test case number (starting from 1) and Y is a real number indicating the desired answer. Retained one decimal places.
  • 样例输入
  • 10 0.50000
    10 0.40000
  • 样例输出
  • Case 1: 2.7
    Case 2: 3.5
  • 提示
  • 来源
  • Hungar
  • 操作

显示春菜