Exact solutions for scalar field cosmology in f(R) gravity