Algorithm title: UVA 10169

Source: Internet
Author: User

Problem B

Urn-ball probabilities!

Input:standard input

Output:standard output

Time Limit:3 seconds

Assume that you have two urns before. Initially, one urn has one ball and the other urn has two balls and exactly one ball into each urn is red. At this initial stage your are asked to pick up two balls, one from each urn. Then one white ball are added in each urn and your are again asked to pick up one ball from each urn Then again one white BA ll is added in each urn. This process continues to a certain time. Remember that's the picked ball the urn after each pick up. You'll have to determine the probability of your pickups both of the picked balls were red and also the prob Ability that all of the your picked balls were certain red after steps.

Input

The input file contains several lines of inputs. Each line of the input file contains a unsigned integer N (n<1000000) indicating how many times you'll pick up. Course after each pick up a increment in balls occurs as described previously.

Output

For each line of input print a single line of output containing a floating point number and integer. The floating-point number indicates the probability that your have picked up two red balls to at least one of your pick-ups and the second integer denotes how many consecutive zeros are after decimal point in the There value Of your pick ups has both balls as red.

Sample Input:

1

2

20

Sample Output:

0.500000 0

0.583333 1

0.688850 38

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.