Tai's formula

This commit is contained in:
jadmin committed 2023-07-16 22:20:32 +02:00
1 parent 4bc8d64e38
commit eccd02fbbc
1 file changed
+19
+19
View File
@@ -0,0 +1,19 @@
n = int(input())
prev_t = 0
prev_v = 0
total = 0
for i in range(n):
m = input().split()
t = int(m[0])
v = float(m[1])
if prev_t == 0:
prev_t = t
prev_v = v
continue
total += ((prev_v + v) / 2) * (t - prev_t) / 1000
prev_t = t
prev_v = v
print(total)