If the price charged for a candy bar is p(x) cents, then x thousand candy bars will be sold in a certain city, where p(x) = 39 - . How many candy bars must be sold to maximize revenue?

I thought I could solve this problem by using implicit differentiation

but don't know how to... Please help.