CCC '11 S2 - Multiple Choice

View as PDF

Submit solution


Points: 5
Time limit: 2.0s
Memory limit: 256M

Problem type
Canadian Computing Competition: 2011 Stage 1, Senior #2

Your teacher likes to give multiple choice tests. One benefit of giving these tests is that they are easy to mark, given an answer key. The other benefit is that students believe they have a one-in-five chance of getting the correct answer, assuming the multiple choice possibilities are A, B, C, D or E.

Write a program that your teacher can use to grade one multiple choice test.

Input Specification

The input will contain the number N (0 < N < 10\,000) followed by 2N lines. The 2N lines are composed of N lines of student responses (with one of A, B, C, D or E on each line), followed by N lines of correct answers (with one of A, B, C, D or E on each line), in the same order as the student answered the questions (that is, if line i is the student response, then line N+i will contain the correct answer to that question).

Output Specification

Output the integer C (0 \le C \le N) which corresponds to the number of questions the student answered correctly.

Sample Input 1

3
A
B
C
A
C
B

Output for Sample Input 1

1

Sample Input 2

3
A
A
A
A
B
A

Output for Sample Input 2

2

Comments


  • -2
    cretin  commented on Nov. 30, 2022, 6:55 p.m.

    I find the problem almost impossible to understand. I've read the text three times already. Not a great job explaining it, I have to say.


    • -2
      cretin  commented on Dec. 1, 2022, 3:49 a.m. edited

      I think I get it, but I'm not really sure. So the first line is a digit that represents the number of questions/answers that the students gives. The come the real answers which need to have the same number of lines. There's no mention at all about how these answers are generated or I'm missing something. Otherwise I'll have to assume that the correct answers are actually random.


      • -2
        fireheartjerry  commented on Dec. 3, 2022, 11:29 a.m. edit 2

        First line of input: Number of questions in the test (N).

        First N lines of input (not including first line): The answers the student gave.

        Next N lines of input: The answer key (assume this is by default correct).

        The question is asking you the number of answers the student got correctly. How these answers are generated does not matter.


  • -1
    Iqra_bashir  commented on Oct. 23, 2022, 1:04 p.m.

    I am so lost on how to code this, could someone please help


  • 0
    Tofer_G  commented on June 16, 2022, 12:54 p.m.

    How do entries end up on the "best submissions" list? Is it based off processing time and size?


    • 0
      jerrycui07  commented on June 27, 2022, 10:17 a.m.

      It appears to be ranked off the time it took the program to output the answer. Apparently someone got 0 seconds.


  • 2
    ServontiusT  commented on Aug. 21, 2021, 9:37 a.m.

    My code worked. The problem, however, is I wrote most of it, stepped away to clear the mind before coming back and finishing it. What I don't quite understand is why it worked. Specifically the num2 - n conditional check. Would anyone be able to help me understand? I can't be alone in feeling this way about my code from time to time.


    • 1
      Marshmellon  commented on Aug. 21, 2021, 10:39 a.m. edited

      By num2 - n conditional check, you mean your 2nd loop right? If so, you are looping to n with num2 (i.e the first list of answers) and checking if that index of the string is equal to that index - n (i.e the matching index in the second list).


      • 1
        ServontiusT  commented on Aug. 22, 2021, 4:05 p.m.

        You're right. For some reason, as I was reading it, I was thinking of it as an arithmetic operator and not going backwards in that index. Thanks!


  • 2
    KingT  commented on Dec. 1, 2018, 9:21 p.m.

    Can someone help me with my solution. I keep getting a runtime error.


    • 5
      kingW3  commented on Dec. 2, 2018, 6:11 a.m.

      Check the second loop you don't want the condintion i<SIZE


      • 5
        KingT  commented on Dec. 3, 2018, 5:52 p.m.

        Thank you very much.