1510: 【11】处理数列▅max_min_index
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:31
Solved:16
Description
把数字列表中的最大值与最小值交换位置。
Input
第一行,一个正整数n(1≤n≤50)。
第二行,n个正整数,相邻两个数之间用一个空格分开,每个数的值在1到500之间。
提示:
s = input() #输入一个字符串,赋值给s。
a = s.split('') #将字符串s按空格拆分,保存到列表a中。
lis =[int(i) for i in a] #将列表a的元素转换成整数,保存到列表lis中。
Output
输出一行,共n个数,表示将最大值和最小值交换位置后的数列,相邻两个数之间用一个空格分开。
Sample Input Copy
5
3 9 2 1 5
Sample Output Copy
3 1 2 9 5