Offline Power Allocation And Spectrum Sensing Strategy In Energy-Harvesting Cognitive Radio Networks