#include #include #include "geometry.hpp" // import java.util.List; // import java.util.*; // import java.awt.*; // from math import sqrt // from math import * using std::cin; using std::cout; using std::endl; /** * Reads points in plane from standard input in form * * 0 0 * 1 1 * 3 1 * 4 0 * * and outputs the total length of the segments that * connect them. * * Compile with * * g++ -Wall -pedantic -std=c++17 -o Distance distance.cpp * * and then run with * * ./Distance */ int main(int argc, char **argv) { double last_x, last_y; double x, y; double total_distance = 0.0; cin >> last_x >> last_y; // extract from stream cin (standard input) while (cin >> x >> y) { total_distance += geometry::euclidean_distance(last_x, last_y, x, y); last_x = x; last_y = y; } cout << total_distance << endl; }