Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- double distance(int xa, int ya, int xb, int yb) {
- return sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
- }
- double getPerimeter(int xa, int ya, int xb, int yb, int xc, int yc) {
- return distance(xa, ya, xb, yb) + distance(xa, ya, xc, yc) + distance(xb, yb, xc, yc);
- }
- int main() {
- int xa, ya, xb, yb, xc, yc;
- cin >> xa >> ya >> xb >> yb >> xc >> yc;
- cout << getPerimeter(xa, ya, xb, yc, xc, yc) << endl;
- int xp, yp, xq, yq, xr, yr;
- cin >> xp >> yp >> xq >> yq >> xr >> yr;
- cout << getPerimeter(xp, yp, xq, yq, xr, yr)
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement