That looks like a nice question, although it looks like I've lost, as I can't figure out what the input represents. Any tips?
6
2 1.0
3 1.0
4 1.0
3 0.5
5 0.678
9 0.87
First line means there will be 6 test cases. Each of the following 6 lines contains one test case (each test case represents one ping-pong tournament, and each test case is independent of the others).So the first line means there's a tournament with N=2 players, and P=1.0, which means that in any matchup, the higher-ranked player has a 100% chance of defeating the lower-ranked player.
The fourth line means there's a tournament with N=5 players, and P=0.678, which means in any matchup, the higher-ranked player has a 67.8% chance of defeating the lower-ranked player.