Physics Question, Lunchtime 17

getting WA

Ball will rebounds infinitely as given in the question

But in the second else if condition you put a[i]/a[j]==f && a[i]%a[j]==0

It means it checks only when ball rebounds for its first time and if it is you divided it by f

Let us take a test case

2 2

1 4

when you consider 4 your program check only for 4 and 2 not for 1 but it has to be included

So the answer for the above test case will be 1

But your program is outputting 0 for it