题目叙述
问题描述:略
输入格式:略
输出格式:略
样例
样例输入
3
-1 2 4
样例输出
4 2 -1
样例输入
4
-2 -1 3 4
样例输出
4 1 -2
满分证明
解题思路
- // 整除的运用;
- 函数round取整;
- 判断如果是整数则输出整数,如果是小数则输出小数。
满分代码
满分代码一
input()
ll = list(map(int, input().split()))
ll.sort()
if len(ll) % 2 == 1:
zz = ll[((len(ll) - 1) // 2)]
else:
zz = round(((ll[((len(ll) // 2))] + ll[((len(ll) // 2) - 1)]) / 2), 1)
if str(zz)[-1] == "0":
zz = int(zz)
print(max(ll), zz, min(ll), end=" ")
满分代码二
n = int(input())
ll=sorted(list(map(int,input().split())))
temp=0
if n%2==0:
temp=(ll[n//2]+ll[n//2-1])/2
temp=round(temp,1)
if temp*10%10==0:
temp=int(temp)
else:
temp=ll[n//2]
print(ll[-1],temp,ll[0])
需者自取传送门(∩ᄑ_ᄑ)⊃━☆【CCF 2013-2021】本博主整理历年至少前两题 python 满分代码目录