Unexpected Runtime error in my solution for "Important exam".

Revision en2, by levi.ackerman1732, 2020-02-13 15:26:38

Hello all

1201A - Important Exam

My solution, was to store the number of responses(among A,B,C,D,E) for each question and choose the maximum among them and multiply with the marks awarded. I am getting a Runtime error. I am not able to figure out why.

The part of code where it's failing is:

s is string, j is the question number

	temp = (int)(s[j]-'A');

	v[j][temp]++;

I have encountered this problem quite a few times, but have avoided every time somehow. Please do let me know what is wrong with this.

My solution: 70953260

I am extremely sorry if I am asking something that is fairly obvious. Thank you for your time.

Tags #implementation, #strings, #brute force

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English levi.ackerman1732 2020-02-13 15:26:38 11
en1 English levi.ackerman1732 2020-02-13 15:25:27 731 Initial revision (published)