|
|
вернуться в форумWhat's wrong with it?I am getting WA. #include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { int i,j,N,p; std::cin>>N; float cd[N][2],R,dist = 0.0; std::cin>>R;
for(p = 0;p < N;p++) std::cin>>cd[p][0]>>cd[p][1];
i = 0; j = i + 1;
dist = (2 * std::acos(-1.0) * R); while(i < N) { dist += std::sqrt( ( (cd[j][0] - cd[i][0]) * (cd[j][0] - cd[i][0]) ) + ( (cd[j][1] - cd[i][1]) * (cd[j][1] - cd[i][1]) ) ); i++; j = (i + 1) % N; }
std::cout <<std::setprecision(2) << std::fixed <<dist; return 0; } Re: What's wrong with it?I am getting WA. Try test 1 1 0 0 |
|
|