This study addresses the issue of inefficient resource allocation and task scheduling in the"cloud-edge-end"scenario,proposing an optimization strategy based on a weighted comprehensive cost model and simulated annealing algorithm.Simulation experiments demonstrate that this strategy significantly improves resource utilization,reduces task latency,and lowers system costs,thus holding substantial practical value for resource allocation and task scheduling optimization in 5G networks.