更新第 2 次作业 1-7 题

This commit is contained in:
Luthics 2022-10-20 21:19:01 +08:00
parent 9a677b84e9
commit ba25d575d1
7 changed files with 60 additions and 0 deletions

6
homework/2/1.py Normal file
View File

@ -0,0 +1,6 @@
print('''
精勤求学
敦笃励志
果毅力行
忠恕任事
''')

2
homework/2/2.py Normal file
View File

@ -0,0 +1,2 @@
a = float(input())
print(a*666.666666667)

8
homework/2/3.py Normal file
View File

@ -0,0 +1,8 @@
x1,y1 = map(float,input().split())
x2,y2 = map(float,input().split())
a = complex(round(x1+x2,1),round(y1+y2,1))
b = complex(round(x1-x2,1),round(y1-y2,1))
print(a)
print(b)
# 这个代码暂时有 bug整数的时候不会补 0但是暂时够用了

7
homework/2/4.py Normal file
View File

@ -0,0 +1,7 @@
a, b, c = map(float, input().split())
if (a+b <= c or b+c <= a or c+a < b):
print(-1)
else:
p = (a+b+c)/2
ans = (p*(p-a)*(p-b)*(p-c))**0.5
print("%.2f" % ans)

5
homework/2/5.py Normal file
View File

@ -0,0 +1,5 @@
a, b, c = map(int, input().split())
m = max(a, b, c)
n = min(a, b, c)
p = a+b+c-n-m
print(n, p, m)

22
homework/2/6.py Normal file
View File

@ -0,0 +1,22 @@
a = int(input())
ans = 0
while (a):
if (a >= 100):
a -= 100
ans += 1
elif (a >= 50):
a -= 50
ans += 1
elif (a >= 20):
a -= 20
ans += 1
elif (a >= 10):
a -= 10
ans += 1
elif (a >= 5):
a -= 5
ans += 1
else:
a -= 1
ans += 1
print(ans)

10
homework/2/7.py Normal file
View File

@ -0,0 +1,10 @@
m,kg = map(float,input().split())
b = kg/m**2
if(b<18.5):
print("A")
elif(b<24):
print("B")
elif(b<28):
print("C")
else :
print("D")