Gửi bài giải
Điểm:
1,50 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
When listing document page numbers, it is common to use "-" for the first and last page numbers instead of all pages for at least 3 consecutive pages. Given page numbers needed to list, use the "-" sign to shorten the list
Input
- The first line is N, 1 ≤ N ≤ ~10^{3}~ , the page number listed.The next line contains N integers, representing page numbers. The numbers are all unique.
The first line is N, 1 ≤ N ≤ ~10^{3}~ , the page number listed.
The next line contains N integers, representing page numbers. The numbers are all unique.
Output
- Print out a list of pages in order from smallest to largest.
Sample Input:
6
180 141 174 143 142 175
Sample Output:
141-143 174 175 180
Bình luận