GFSSOC '17 J1 - Ramen and Studying

View as PDF

Submit solution

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

Authors:
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
Math
TOK
English

Sample Output

Go to Metro
2

Comments


  • 1
    CodingCrab_520  commented on March 27, 2024, 9:28 p.m.

    No wonder Ace asked us to help figure this problem out for him, he's probably going to go eat 4 bowls of ramen.

    For TOK, he needs 1 bowl, for English, 2, for Chemistry, 3, and for Math, 4.


  • 1
    Winbigwok  commented on May 6, 2020, 2:03 p.m. edited

    Out of curiosity why does adding

    import sys
    input = sys.stdin.readline

    Change the output the program gives

    https://dmoj.ca/submission/2074623


    • 3
      Ninjaclasher  commented on May 6, 2020, 3:21 p.m. edited

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


  • 7
    geese  commented on Oct. 15, 2018, 1:55 a.m. edited

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