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

Автор hemant_thakur, история, 4 года назад, По-английски

Can someone please help, what am I doing wrong ? Or on what test cases my solution is failing. It passes 12/19 test cases.

Here is the atcoder question link : LINK

Here is my solution:

Code

Thanks in advance :)

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

»
4 года назад, скрыть # |
Rev. 2  
Проголосовать: нравится +1 Проголосовать: не нравится

6

4 4 5 7 8 9

Suppose when you are at index 5 (1-based indexing) , elements you picked were: 4 5 ( let's call it way 1) and in another recursive call at index 5 you picked elements 4 7 ( way 2) , now it may be possible that in way 1 you get an integer average value but it may not be possible with way 2(but your program will return the answer calculated in way 1) , because sum of elements differ in both ways.

Try to visualize the whole process now and change your code accordingly.

Hint 1
Hint 2