Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <math.h>
- using namespace std;
- struct coordonate {
- float x, y;
- } a[1001];
- float distanta(int b, int c) {
- return sqrt(pow((a[b].x - a[c].x), 2) + pow((a[b].y - a[c].y), 2));
- }
- int main() {
- int n = 1, q = 0, d = 0;
- ifstream f("puncte.in");
- ofstream g("puncte.out");
- while (f >> a[n].x >> a[n].y) {
- if (a[n].x > 0 && a[n].y > 0)
- q++;
- n++;
- }
- n--;
- g << q << ' ';
- for (int i = 1; i <= n - 1; i++)
- for (int j = i + 1; j <= n; j++) {
- q = distanta(i, j);
- if (q > d)
- d = q;
- }
- g << d;
- f.close(); g.close();
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement