CCC '16 J1 - Tournament Selection

View as PDF

Submit solution


Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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 Specification

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 Specification

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

Output for Sample Input 1

2

Sample Input 2

L
L
L
L
L
L

Output for Sample Input 2

-1

Comments


  • -3
    cyopotatoe  commented on June 28, 2020, 11:37 p.m.

    I'm just here trying to find a comment that has more than 2 upvotes


  • -3
    Richard_Ni  commented on Feb. 16, 2020, 2:29 p.m.

    nani


  • -4
    christibudder11  commented on Jan. 20, 2020, 12:09 p.m. edited

    sans underscore

    Edit: Thanks for all the likes!! :D I really appreciate it!!


  • -8
    official_james  commented on Nov. 2, 2019, 2:28 a.m.

    This comment is hidden due to too much negative feedback. Click here to view it.


    • -8
      Hoofa  commented on Nov. 2, 2019, 2:31 a.m.

      This comment is hidden due to too much negative feedback. Click here to view it.


    • -8
      Hoofa  commented on Nov. 2, 2019, 2:29 a.m.

      This comment is hidden due to too much negative feedback. Click here to view it.


      • -7
        Unnoficial_James  commented on Nov. 2, 2019, 2:31 a.m.

        This comment is hidden due to too much negative feedback. Click here to view it.


  • -1
    epiclol010  commented on Feb. 18, 2019, 3:14 p.m. edited

    Why are the first and second test cases worth 0 points?


  • 0
    rllyp  commented on Jan. 19, 2019, 3:37 p.m.

    NVM got it working, the program had previous values i had to set to 0


    • -9
      Moto  commented on July 26, 2019, 1:13 p.m.

      This comment is hidden due to too much negative feedback. Click here to view it.


  • 1
    rllyp  commented on Jan. 19, 2019, 2:15 p.m.

    I keep getting IR (NameError) it works in pyzo but not on the online judge