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
    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.

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

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