Tai's formula
This commit is contained in:
19
taisformula.py
Normal file
19
taisformula.py
Normal 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)
|
||||||
Reference in New Issue
Block a user