Monday, 22 September 2014

SPOJ PROBLEM 18240: GENIE SEQUENCE (KURUK14)

Genie sequence defined in the problem statement of an value n would be like:
   n-1 , (1/n-2) , (2/n-3) , (3/n-4)................................, (1/n-2) , (2/n-3) , (3/n-4) ,n-1

 Note: / defines OR i.e. 1 or n-2

So, count of n-1=2
      count of n-2=2/0  for count=0    count of  1=2  ||  count of 1=1  & count of n-2=1
      and likewise for other elements in array.

check till (n-2)/2   it also being inclusive 
costed me an WA!!!!!!!

Check it out Easy Problem!!!!   

No comments:

Post a Comment