【入门6】函数与结构体https://www.luogu.com.cn/training/105#problems
P5735 【深基7.例1】距离函数
import math
def solve(a, b, c, d):
dis = 0.0
dis = (a - c) * (a - c) + (b - d) * (b - d)
dis = math.sqrt(dis)
return dis
x1, y1 = map(float, input().split())
x2, y2 = map(float, input().split())
x3, y3 = map(float, input().split())
C = solve(x1, y1, x2, y2) + solve(x1, y1, x3, y3) + solve(x2, y2, x3, y3)
print("%.2f"%C)
import math
def check(x):
if x < 2:
return False
t = int(math.floor(math.sqrt(x)))
for i in range(2, t+1):
if x % i == 0:
return False
return True
n = int(input())
a = [int(i) for i in input().split()]
b = []
for i in range(n):
if check(a[i]):
b.append(a[i])
for i in range(len(b)-1):
print(b[i], end=' ')
print(b[len(b)-1])
import sys
x, y = map(int, input().split())
def check(n):
if n % 4 == 0:
if n % 100 == 0 and n % 400 != 0:
return False
else:
return True
else:
return False
a = []
for i in range(x, y+1):
if check(i):
a.append(i)
cnt = len(a)
print(cnt)
if cnt > 0:
for i in range(cnt - 1):
print(a[i], end=' ')
print(a[cnt - 1])
else:
sys.exit(0)
n, m = map(int, input().split())
ans = []
for i in range(n):
a = [int(i) for i in input().split()]
a.sort()
la = len(a)
sum = 0
for i in range(1, la-1):
sum += a[i]
k = sum / (la - 2)
ans.append(k)
ans.sort()
print("%.2f"%ans[n-1])
n = int(input())
def dfs(x):
if x == 1:
return x
return x * dfs(x-1)
print(dfs(n))