Table of contents
1. Topic description
It’s summer vacation, and Xiao Ming decides to go to a certain tourist attraction. He searches the Internet for hotels of various prices (array A of length n), and his psychological price is x yuan. Please help him to select k hotels closest to x hotels (n>=k>0), and print the hotel prices from low to high.
2. Enter description
First row: n,k, x
Second row: A[o] A[1] A[2]…A[n-1]
3. Output description
Prints the filtered hotel prices from low to high.
4. Problem-solving ideas
- Read the input hotel quantity hotelCount, select the quantity selectCount, and psychological price targetPrice;
- Create a size of hotelC