F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

I Will Win

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 503    Accepted Submission(s): 289


Problem Description
Dumbear likes to play table tennis with his daughter ¨C Quan. But Dumbear found that Quan played table tennis better and better recently, Dumbear wondered that Quan would defeat him someday. So he wants to know if he will win in the next match.

To simplify the problem, you can assume that the probability of Dumbear¡¯s winning in each match is a constant number P (But Dumbear and you don¡¯t know the number exactly). Of course 0 ¡Ü P ¡Ü 1. Dumbear had already taken N matches with Quan. And he won for M matches. He wants to know the expected probability of his winning for the next match. But Dumbear is very dumb, so he wants you to help him.
 

Input
Each line of the input file contains two numbers N and M (0 ¡Ü M ¡Ü N) indicate the number of the matches Dumbear had taken and the number of matches Dumbear had won. The last line of the input file contains two numbers "0 0".
 

Output
For each line, output two integers A and B indicates the expected probability of Dumbear¡¯s winning for the next match is A / B. Make sure that gcd(A, B) = 1!
 

Sample Input
1 1 2 1 0 0
 

Sample Output
2 3 1 2
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 09:44:18, Gzip enabled