DCP-470: The Two Giants Back to All Problems

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


Problem Setter:

Feroz Ahmmed

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 1.00
C++ 1.00
C++14 1.00
C# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats

14/30

Solve/Submission

Ranking

# User Language Timing
01 Trumen Cpp 0.00s
02 feodorv C 0.00s
03 Morass Cpp14 0.01s
04 mh755628 Cpp 0.01s
05 showmic Cpp14 0.01s
06 _c_k_r_ Cpp 0.01s
07 njrafi Cpp 0.02s
08 Tahmid Cpp14 0.02s
09 muradhossen Cpp14 0.04s
10 SbrTa Cpp14 0.05s
11 PKP_007 Cpp 0.93s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support