Блог пользователя perfectionist7

Автор perfectionist7, 20 месяцев назад, По-английски

So, when I put in the language to be GNU G++20, the program shows testcase failed at testcase 27 which is

3 1 2 2 2 3

It shows I become the guy in the Participant's output section but when I run the exact same code in my VS Code, it shows the output as Oh, my keyboard! which is the same as the jury's answer. I can't really understand whats wrong.

My code —

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
7 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Me too!

»
7 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

So, the mistakes in this code is about indices. Your code is giving an out of bound error.

1) In line 19, when you do arr3[i]=arr[i], you know that arr only have length a, so it cannot have index till a+b.

2) In line 25, except of doing i<=a+b, do i<a+b.

Please make a habit to take care of the indices of the arrays when writing a code.