Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Abejas WA
#include <iostream> #include <math.h> #include <vector> #include <algorithm> using namespace std; struct point { int x, y; double eps = 1.0e-10; void push(int x, int y) { this->x = x; this->y = y; } bool operator <(point z) { if(fabs(x-z.x) > eps) return x < z.x; else return y < z.y; } }; int main() { int T, N, K; char R; double x, y, a, b; double pi = 3.14159265359; double radio, area; point punto; vector<point> puntos; cin >> T; while(T--) { cin >> x; cin >> y; cin >> N; cin >> K; while(N--) { cin >> a; cin >> b; punto.push(a-x,b-y); puntos.push_back(punto); } cin >> R; sort (puntos.begin(), puntos.end()); radio = sqrt ( puntos[K-1].x*puntos[K-1].x + puntos[K-1].y*puntos[K-1].y ); area = pi * radio * radio; printf("%.2lf\n", area); puntos.clear(); } }
run
|
edit
|
history
|
help
0
References Pt 1 C++
Cley
Example Iterator Increment
Logical AND versus Bitwise AND
kap03_09
suffle array
12hours Clock c++
Wuninitialized
Dar
C++ object lifecycle example