GFSSOC '17 J1 - Ramen and Studying

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 31M

Authors:
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

While studying after school, Ace always needs Ramen to keep himself energized. For different courses, Ace needs different numbers of bowls of Ramen to be able to study them. For TOK, he needs 1 bowl, for English, 2, for Chemistry, 3, and for Math, 4. Ace always strives to study as many subjects a day as possible, and he only has N (0 \le N \le 100) bowls of Ramen at home. For tonight, Ace has to study for C (1 \le C \le 4) courses. He needs your help to figure out whether or not he has enough bowls or not. If Ace has enough bowls of Ramen, output YEA BOI. If he doesn't, output Go to Metro and the maximum number of courses he can finish with his current supply of Ramen on a new line.

Input Specification

Line 1: integers C, N

Next C lines: Courses Ace must study for (TOK, English, Math, and Chem)

Sample Input 1

3 6
Math
TOK
English

Sample Output 1

Go to Metro
2

Comments


  • 0
    Winbigwok  commented on May 6, 2020, 10:03 a.m.

    Out of curiosity why does adding

    import sys
    input = sys.stdin.readline

    Change the output the program gives

    https://dmoj.ca/submission/2074623


    • 2
      Ninjaclasher  commented on May 6, 2020, 11:21 a.m.

      sys.stdin.readline does not strip the trailing newline, while input does. If you manually strip away the trailing newline, your submission will AC.


  • 0
    LucaC  commented on May 4, 2020, 8:40 a.m. edited

    [deleted]


    • 0
      boolean  commented on May 5, 2020, 12:19 p.m.

      What language are you using? With c++, a simple cin>>c>>n where c, n are declared as ints would suffice. With Java, you can initialize a String[]temp, then read the line using BufferedReader, then use the .split(" ") command which takes the space as a parameter and returns each space-separated character as an element in the array. (temp=br.readLine().split()). You can then parse it into two ints c, n using Integer.parseInt(temp[0]), etc. and solve as required.

      Or just use C++ to avoid that trouble :)


      • 0
        LucaC  commented on May 6, 2020, 7:39 a.m. edited

        [deleted]


  • 5
    geese  commented on Oct. 14, 2018, 9:55 p.m.

    Damn this dude TimothyW553 has the exact same answer as nathanl3.