|
|
вернуться в форумWhat is wrong? / WA#1 #include <iostream> #include <iomanip> #include <cmath> using std::cin; using std::cout; using std::endl; using std::setprecision; using std::fixed; int main() { int n; double r,s=0,x,y,x0,y0,xn,yn; cin >> n >> r; if (n==1) { cin >> x >> y; } if (n>1) {
cin >> x >> y; for (int i=1;i<=n-1;i++) { cin >> x0 >> y0; s=s+sqrt((x0-x)*(x0-x)+(y0-y)*(y0-y)); x=x0;y=y0; } s=s+sqrt((xn-x)*(xn-x)+(yn-y)*(yn-y)); } s=s+2*3.1415*r; cout << fixed << setprecision(2) << s << endl; return 0; } DEV-C++ 5.11 Edited by author 04.06.2017 12:53 Re: What is wrong? / WA#1 Re: What is wrong? / WA#1 Thank you. I feel very sorry for such a stupid mistake... |
|
|