Tech

B - Traveling Takahashi Problem (AtCoder Beginner Contest 375)

Published
Published:
Table of Contents

Problem Link: B - Traveling Takahashi Problem (AtCoder Beginner Contest 375)

Approach

The code takes a list of points and calculates the total distance between them. It first reads the points, adds the origin (0,0)(0, 0) at the start, reverses the list, adds origin at end again, updates the size of nn and and then computes the distance between each pair of consecutive points. Finally, it prints the total distance with precision 2020.

Code Implementation