Fog computing has become a hot topic in recent years as it provides cloud computing resources to the network edge in a distributed manner that can respond quickly to intensive tasks from different user equipment (UE) applications. However, since fog resources are also limited, considering the number of Internet of Things (IoT) applications and the demand for traffic, designing an effective offload strategy and resource allocation scheme to reduce the offloading cost of UE systems is still an important challenge. To this end, this paper investigates the problem of partial offloading and resource allocation under a cloud-fog coordination network architecture, which is formulated as a mixed integer nonlinear programming (MINLP). Bring in a new weighting metric-cloud resource rental cost. The optimization function of offloading cost is defined as a weighted sum of latency, energy consumption, and cloud rental cost. Under the fixed offloading decision condition, two sub-problems of fog computing resource allocation and user transmission power allocation are proposed and solved using convex optimization techniques and Karush-Kuhn-Tucker (KKT) conditions, respectively. The sampling process of the inner loop of the simulated annealing (SA) algorithm is improved, and a memory function is added to obtain the novel simulated annealing (N-SA) algorithm used to solve the optimal value offloading problem corresponding to the optimal resource allocation problem. Through extensive simulation experiments, it is shown that the N-SA algorithm obtains the optimal solution quickly and saves 17% of the system cost compared to the greedy offloading and joint resource allocation (GO-JRA) algorithm.