a859: Tournament Selection
Tags : if 多分支 累加 迴圈
Accepted rate : 30人/34人 ( 88% ) [非即時]
評分方式:
Tolerant

最近更新 : 2022-10-26 12:35

Content

Each player in a tournament plays six games. There are no ties. The tournament director places the players in groups based on the results of games as follows:

  • if a player wins 5 or 6 games, they are placed in Group 1;
  • if a player wins 3 or 4 games, they are placed in Group 2;
  • if a player wins 1 or 2 games, they are placed in Group 3;
  • if a player does not win any games, they are eliminated from the tournament.

Write a program to determine which group a player is placed in.

Input

The input consists of six lines, each with one of two possible letters: W (to indicate a win) or L (to indicate a loss).

Output

The output will be either 1, 2, 3 (to indicate which Group the player should be placed in) or -1 (to indicate the player has been eliminated).

Sample Input #1
W
L
W
W
L
W
Sample Output #1
2
Sample Input #2
L
L
L
L
L
L
Sample Output #2
-1
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (20%): 1.0s , <1K
公開 測資點#1 (20%): 1.0s , <1K
公開 測資點#2 (20%): 1.0s , <1K
公開 測資點#3 (20%): 1.0s , <1K
公開 測資點#4 (20%): 1.0s , <1K
Hint :
Tags:
if 多分支 累加 迴圈
出處:
CCC2016 [管理者:
issin@g.puic... (冼一心老師)
]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」