VACCINE3 - solution fails when double is returned instead of int

why does the solution fail when i return a double (using ceil) instead of int?

QUESTION : VACCINE3 Problem - CodeChef

This works : cout<<(int)ceil((s+1)*1.0/p)<<" “<<(int)ceil((s+x[g-1])*1.0/p)<<”\n";

But this doesnt : cout<<ceil((s+1)*1.0/p)<<" “<<ceil((s+x[g-1])*1.0/p)<<”\n";

Ceil function many a times sucks