Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #define PI 3.1415926
- using namespace std;
- int main(){
- int n;
- double r, x0, y0, x1, y1, x2, y2, ans = 0;
- cin >> n >> r;
- ans += 2 * PI * r;
- if (n == 1){
- cout << (floor(ans * 100 + 0.5)) / 100. << endl;
- return 0;
- }
- cin >> x0 >> y0;
- x1 = x0, y1 = y0;
- for (int i = 1; i < n; i++){
- cin >> x2 >> y2;
- ans += sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
- x1 = x2;
- y1 = y2;
- }
- ans += sqrt((x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0));
- cout << (floor(ans * 100 + 0.5)) / 100. << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement