UVa 10903

From Algorithmist
Jump to: navigation, search

10903 - Rock-Paper-Scissors Tournament[edit]

Summary[edit]

In this problem you have to find the "win average" on a tournament of Rock-Paper-Scissors.

Explanation[edit]

Just keep the number of times each player has won and lost while taking the input. In the end print out {\frac  {W}{W+L}}, where w is the number of games won, and l is the number of games lost.

Implementations[edit]

Input[edit]

2 4
1 rock 2 paper
1 scissors 2 paper
1 rock 2 rock
2 rock 1 scissors
2 1
1 rock 2 paper
3 1
1 rock 3 paper
3 scissors 2 scissors
2 scissors 1 scissors
3 1
1 rock 2 paper
2 paper 3 scissors
3 scissors 1 rock
0

Output[edit]

0.333
0.667

0.000
1.000

0.000
-
1.000

0.500
0.500
0.500