Omae Wa Mou Shindeiru

Chronos LU CSE Carnival 2019 Inte...
Limits 1s, 512 MB

Itachi and Sasuke are trying to beat Kabuto, the caster of an awesome magical spell (or you can say jutsu). Kabuto has a power level of N. The fight between them is quite weird. There's a bag with some potions that contain power. There are exactly N potions in the bag and the i'th potion has a power level of i (i starts from 1).

Itachi and Sasuke each pull out a random potion from the bag simultaneously. If the power level of each of their potions is co-prime with N and the sum of their power levels is greater than N, then Itachi and Sasuke say to Kabuto, "Omae Wa Mou Shindeiru". Kabuto then shouts, "NANI???" and dies with a poof!!!

As you are a great mathematician and programmer and they are not, can you tell what is the probability that Itachi and Sasuke can say, "Omae Wa Mou Shindeiru"???


There will be several test cases. The first line will contain an integer T (1 <= T <= 1000) denoting the number of test cases.

The next T lines each will contain an integer N (2 <= N <= 1015), the power level of Kabuto.

The inputs are randomly generated.


For each test case, print the probability of Itachi and Sasuke saying "Omae Wa Mou Shindeiru" in a new line. Your answer should be rounded to exactly 10 digits after the decimal.




Login to submit.


73% Solution Ratio
NirjhorEarliest, Oct '19
NirjhorFastest, 0.0s
NirjhorLightest, 131 kB
steinumShortest, 1644B
Toph uses cookies. By continuing you agree to our Cookie Policy.