n = int(sys.stdin.readline())
point = []
for _ in range(n):
a, b = map(int, sys.stdin.readline().split())
point.append([a, b])
xold, yold = point.pop(0)
Point.append([xold, yold]) # After selecting the starting point, add the starting point again at the end.
area = 0
while point:
nx, ny = point.pop(0)
area += (old +ny) * (nx - xold) / 2 # Add trapezoidal width
xold, yold = nx, ny
print("%.1f" % abs(area))
C (n) It's a code to find the width of a square
This is what I drew on the canvas,
I logarithmically took the coordinate values of the squares in the figure
Where should I put this coordinate value as a variable to calculate the result value in print statement??
python
point = [
[38, 58],
[38, 59],
[38, 60],
[38, 61],
[38, 62],
[38, 63],
[38, 64],
[38, 65],
[39, 66],
]
xold, yold = point.pop(0)
Point.append([xold, yold]) # After selecting the starting point, add the starting point again at the end.
area = 0
while point:
nx, ny = point.pop(0)
area += (old +ny) * (nx - xold) / 2 # Add trapezoidal width
xold, yold = nx, ny
print("%.1f" % abs(area))
You can do this under the assumption that you use the code as much as you can.
© 2024 OneMinuteCode. All rights reserved.