Medium Math > Probability/Expected Value

Background ----- This is a story for kids. The Two Giants live in a part of the world where everything is perfect and they are the best of friends … until they quarrel. Then their beautiful world becomes dark and miserable. What will it take for them to become friends again? Problem ----- Giant-1 had born in a **leap year** and Giant-2 had born in a year which is **not a leap year**. Now they will meet after they solve this simple math. What is the probability that their **N** th birthday is a leap year? Input ------ Input starts with an integer **T (T <= 1000)**, denoting the number of test cases. Each case contains an integer **N (1990 ≤ N ≤ 10^18)** denoting which birthday they are interested in. Output ------- For each case of input, output the case number and two values (the probability of Giant-1's Nth birthday is a leap year and Giant-2's Nth birthday is a leap year) in a seperate line. Print the values rounded to **6th** decimal place. Sample Input ------------ 2 10 12 Sample Output ------------- Case 1: 0.000000 0.320132 Case 2: 0.969072 0.009901

Feroz Ahmmed