牛客网刷题-(2)

简介: 牛客网刷题-(2)

(1)两点间的距离

# 两点间的距离
#tip1:不使用math库
x1,y1=map(float,input().split())
x2,y2=map(float,input().split())
D = ((x2 - x1)**2 + (y2 - y1)**2)**0.5
print("%.4f"%D)
#tip2: 使用math库
from math import sqrt
x1,y1 = map(float,input().split())
x2,y2 = map(float,input().split())
D = sqrt((x2 - x1)**2 + (y2 - y1)**2)
print("%.4f"%D)

(2)钞票 -顺序结构

N = int(input())
print(N)
print("%d nota(s) de R$ 100,00 "%(N // 100))
N %= 100
print("%d nota(s) de R$ 50,00 "%(N // 50))
N %= 50
print("%d nota(s) de R$ 20,00 "%(N // 20))
N %= 20
print("%d nota(s) de R$ 10,00 "%(N // 10))
N %= 10
print("%d nota(s) de R$ 5,00 "%(N // 5))
N %= 5
print("%d nota(s) de R$ 2,00 "%(N // 2))
N %= 2
print("%d nota(s) de R$ 1,00 "%(N // 1))

(3)差

#差-顺序结构
A = int(input())
B = int(input())
C = int(input())
D = int(input())
X =(A * B - C * D)
print("DIFERENCA = %d"%X)

(4)工资

#工资
x = int(input())
t = int(input())
S = float(input())
SALARY = float(t * S)
print("NUMBER = %d"%x)
print("SALARY = U$ %.2f"%SALARY)

目录
相关文章
|
7月前
牛客网刷题总结4-22
牛客网刷题总结4-22
34 0
牛客网刷题-(7)
牛客网刷题-(7)
39 1
牛客网刷题-(10)
牛客网刷题-(10)
42 0
牛客网刷题-(5)
牛客网刷题-(5)
47 0
牛客网刷题-(9)
牛客网刷题-(9)
52 0
牛客网刷题-(8)
牛客网刷题-(8)
44 0
牛客网刷题-(4)
牛客网刷题-(4)
44 0
牛客网刷题-(11)
牛客网刷题-(11)
43 0
牛客网刷题-(3)
牛客网刷题-(3)
40 0
牛客网刷题-(6)
牛客网刷题-(6)
43 0
下一篇
DataWorks