GFSSOC '17 J1 - Ramen and Studying

View as PDF

Submit solution

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

Problem type

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

3 6

Sample Output

Go to Metro


  • 1
    dchoo333  commented on Aug. 25, 2021, 7:15 a.m.

    Could someone tell me why my submission is getting only Test Cases #2 and #3 correct? Thanks.

  • 1
    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

    • 3
      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


    • 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


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

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