Not sure why this is a calculus problem, as algebra is sufficient to solve it.
While there are many ways to accomplish this, assume that one person does all the driving. He shuttles the other n-1 people between a forward pack that will arrive on foot at the destination at time T and a rear pack that departed the starting point on foot at time 0.
The car drives back and forth a total distance of cT, and advances a net distance of D, so it drives in the forward direction (carrying one passenger) for a total distance of cT/2 + D/2, and it drives back without passengers for a total distance of cT/2 - D/2. Total time spent driving forward = (cT/2 + D/2)/c = (T +D/c)/2.
Dividing by n-1, we see that each of the n-1 walkers spends time of (T+D/c)/2(n-1) being driven forward for a distance of (cT+D)/2(n-1).
When not being driven, each of the n-1 walkers walks for the remaining time of T - ((T+d/c)/2(n-1)) and a distance of p(T - ((T+d/c)/2(n-1))).
For each of the n-1 walkers,
D = distance driven + distance walked =
(cT+d)/2(n-1) + p(T - ((T+d/c)/2(n-1)))
Solving for T gives
(p + (2n-3)c)
T = (D/c)* ---------------
(c + (2n-3)p)
This formula only works for N > 1, c >= p, because otherwise we do not have one person driving others.
It checks out for several special cases:
If n = 2, T = D/c (one car with two passengers does a single one-way trip)
If c = p, T = D/c (everybody might as well walk)
If p = 0, T = (2n - 3)(D/c) (Nobody walks. Car makes (2n - 3)/2 round trips from start to finish)