作业帮 > 英语 > 作业

英语翻译Little Petya very much likes arrays consisting of n inte

来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/07/08 13:57:45
英语翻译
Little Petya very much likes arrays consisting of n integers,where each of them is in the range from 1 to 109,
inclusive.Recently he has received one such array as a gift from his
mother.Petya didn't like it at once.He decided to choose exactly one
element from the array and replace it with another integer that also
lies in the range from 1 to 109,inclusive.It is not allowed to replace a number with itself or to change no number at all.After
the replacement Petya sorted the array by the numbers' non-decreasing.
Now he wants to know for each position:what minimum number could occupy
it after the replacement and the sorting.
InputThe first line contains a single integer n (1 ≤ n ≤ 105),which represents how many numbers the array has.The next line contains n space-separated integers — the array's description.All elements of the array lie in the range from 1 to 109,inclusive.
OutputPrint n
space-separated integers — the minimum possible values of each array
element after one replacement and the sorting are performed.
题目中的105等均为10e5,109位10e9.
小Petya非常喜欢由n个整数排成的数列,其中数列每个元素都是位于1到10e9的整数.最近Petya妈妈送给了他一组数列作为礼物.但是他并不喜欢.他决定用一个整数来来代替这个数列中的某一个数,而这个整数必须同样位于1到10e9之间.不允许用一个数字代替它本身,或者根本不做替换.
在做完替换之后petra把这个数列排列成一个非降序列(也就是广义递增数列).现在他想知道在数列的每个位置:在替换和排列之后,最小的数是多少.
输入:第一行是一个整数n(1 ≤ n ≤ 10e5),这个数表示这个数列中有多少个数.第二行包含n个用空格隔开的整数—这是数据的描述部分.这个数列每个元素都是位于1到10e9的整数.
输出n个用空格隔开的整数—数列在排列和替换之后每个位置有可能存在的最小值.
备注:打字不容易啊,分就给了吧