{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"Rock-Paper-Scissors is game for two players, A and B, who each choose, independently of the other, one of rock, paper, or scissors. A player chosing paper wins over a player chosing rock; a player chosing scissors wins over a player chosing paper; a player chosing rock wins over a player chosing scissors. A player chosing the same thing as the other player neither wins nor loses. \r\u003cbr\u003eA tournament has been organized in which each of n players plays k rock-scissors-paper games with each of the other players - k*n*(n-1)/2 games in total. Your job is to compute the win average for each player, defined as w / (w + l) where w is the number of games won, and l is the number of games lost, by the player.\r\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Input consists of several test cases. The first line of input for each case contains 1 \u0026lt;\u003d n \u0026lt;\u003d 100 1 \u0026lt;\u003d k \u0026lt;\u003d 100 as defined above. For each game, a line follows containing p1, m1, p2, m2. 1 \u0026lt;\u003d p1 \u0026lt;\u003d n and 1 \u0026lt;\u003d p2 \u0026lt;\u003d n are distinct integers identifying two players; m1 and m2 are their respective moves (\"rock\", \"scissors\", or \"paper\"). A line containing 0 follows the last test case."}},{"title":"Output","value":{"format":"HTML","content":"Output one line each for player 1, player 2, and so on, through player n, giving the player\u0027s win average rounded to three decimal places. If the win average is undefined, output \"-\". Output an empty line between cases. "}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2 4\r\n1 rock 2 paper\r\n1 scissors 2 paper\r\n1 rock 2 rock\r\n2 rock 1 scissors\r\n2 1\r\n1 rock 2 paper\r\n0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0.333\r\n0.667\r\n\r\n0.000\r\n1.000\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"Huge input,scanf is recommended."}}]}