WA in spoj PRATA

binary-search

#1

Can anybody tell me where I have made mistake?

Problem

My solution

p.s. How can I use priority queue in it?


#2

You can have a look at My solution using priority queue. Also my binary search approach is here.


#3

Thank you for your reply. I saw your binary search approach. My approach also looks same. You generated the amount of prata using a formula. I used an iterative approach. But it gives the same thing. Where have I made mistake?