![请添加图片描述](https://i-blog.csdnimg.cn/blog_migrate/c41f745e415b69aa93311c002760ddec.bmp)
对称数
n=str(input())
l=len(n)
if ("2" not in n) and ("3" not in n) and ("4" not in n) and ("5"not in n) and ( "7" not in n):
if n[l//2]=="6"or n[l//2]=="9":
print("No")
else:
for i in range(l):
if n[i] == "6" and i != l - 1:
n = n[:i] + "9" + n[i + 1:]
if n[i] == "9" and i != l - 1:
n = n[:i] + "6" + n[i + 1:]
if n[i] == "6" and i == l - 1:
n = n[:i] + "9"
if n[i] == "9" and i == l - 1:
n = n[:i] + "6"
if n == n[::-1]:
print("Yes")
else:
print("No")
else:
for i in range(l):
if n[i] == "6" and i != l - 1:
n = n[:i] + "9" + n[i + 1:]
# continue
if n[i] == "9" and i != l - 1:
n = n[:i] + "6" + n[i + 1:]
if n[i] == "6" and i == l - 1:
n = n[:i] + "9"
if n[i] == "9" and i == l - 1:
n = n[:i] + "6"
if n == n[::-1]:
print("Yes")
else:
print("No")
else :
print("No")
整数组合
l=sum([int(f"{n}"*i) for i in range(1,m+1)])
print(l)
组合数
n=int(input())
i=0
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
if a+b+c+d==n:
i+=1
print(i)
阶乘末尾
n = int(input())
def jiecheng(n):
if n==1:
return 1
else :
return n*jiecheng(n-1)
n=str(jiecheng(n))
n=n[::-1]
l=len(n)
j=0
for i in range(l):
if n[i]=="0" :
j=j+1
else :
break
print(j)
圆
import math
x1=float(input())
y1=float(input())
x2=float(input())
y2=float(input())
x3=float(input())
y3=float(input())
A = x1 * (y2 - y3) - y1 * (x2 - x3) + x2 * y3 - x3 * y2
B = (x1 * x1 + y1 * y1) * (y3 - y2) + (x2 * x2 + y2 * y2) * (y1 - y3) + (x3 * x3 + y3 * y3) * (y2 - y1)
C = (x1 * x1 + y1 * y1) * (x2 - x3) + (x2 * x2 + y2 * y2) * (x3 - x1) + (x3 * x3 + y3 * y3) * (x1 - x2)
D = (x1 * x1 + y1 * y1) * (x3 * y2 - x2 * y3) + (x2 * x2 + y2 * y2) * (x1 * y3 - x3 * y1) + (x3 * x3 + y3 * y3) * (x2 * y1 - x1 * y2)
x = -B / (2 * A)
y = -C / (2 * A)
r = math.sqrt((B * B + C * C - 4 * A * D) / (4 * A * A))
print("{:.3f},{:.3f},{:.3f}".format(r,x,y))
回文数
n = str(input())
if n==n[::-1]:
print('Yes')
else:
print('Not')
平行线
x1=float(input())
y1=float(input())
x2=float(input())
y2=float(input())
x3=float(input())
y3=float(input())
x4=float(input())
y4=float(input())
a1=x2-x1
b1=y2-y1
a2=x3-x4
b2=y3-y4
a3=x4-x1
b3=y4-y1
a4=x3-x2
b4=y3-y2
a5=x3-x1
b5=y3-y1
a6=x4-x2
b6=y4-y2
if a1*b2==a2*b1 :
# if :
# pass
# else:
# print("Not")
print("Yes")
else:
print("No")
斐波那契数
n = int(input())
def fibonacci(n):
if n == 0:
return 0
if n == 1:
return 1
else:
return fibonacci(n - 1) + fibonacci(n - 2)
print(fibonacci(n))
# 另一种写法
# a, b, i = 1, 1, 1
# while i < n:
# a, b = b, a + b
# i += 1
# print(a)
操作数
n=int(input())
j=0
# l=len(str(n))
while True:
l = list(str(n))
for i in range(len(l)):
n = n - int(l[i])
j=j+1
if n<=0:
break
print(j)
方程组
a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())
f = float(input())
if a/d==b/e and a/d!=c/f:
print("error")
else:
x = (c * e - b * f) / (a * e - b * d)
y = (a * f - c * d) / (a * e - b * d)
print("{:.3f} {:.3f}".format(x, y))