Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main(){
- int N;
- double r;
- cin >> N >> r;
- double x[100],y[100];
- for(int i = 0;i < N;++i)
- cin >> x[i] >> y[i];
- double ans = 2 * acos(-1.0) * r + sqrt((double)(x[N - 1] - x[0]) * (x[N - 1] - x[0]) + (double)(y[N - 1] - y[0]) * (y[N - 1] - y[0]));
- for(int i = 0;i + 1 < N;++i)
- ans += sqrt((double)(x[i + 1] - x[i]) * (x[i + 1] - x[i]) + (double)(y[i + 1] - y[i]) * (y[i + 1] - y[i]));
- printf("%.2f\n",ans);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment