Problem:
KND Runs for Sweets
Problem
KND君は会津大学に在籍する学生プログラマである。彼は甘党であることで知られている。彼はとある市に1年間滞在することになり、その期間中に市内にある
N
箇所の甘味処をすべて回りたいと思っている。なのでこの1年間の住む場所は甘味処を回るのに一番適した場所がいいと考えている。彼の隣人であるあなたは、各甘味処への最悪の移動時間が最小になる場所を探す事になった。この甘味処がある市は簡単のため二次元平面で表すことにする。彼は目的の甘味処へのモチベーションの違いにより、単位時間あたりの移動距離が変化する。また、彼はどんな場所にでも（たとえ甘味処と同じ場所であろうと）住むつもりでいる。KND君は甘味に関しては妥協を許さないのである。
Input
入力は複数のテストケースからなる。
ひとつのテストケースは以下のな形式で与えられる。
入力の終了を
N
= 0 のとき示す。
N
x
1
y
1
v
1
x
2
y
2
v
2
...
x
N
y
N
v
N
ここで、
N
:甘味処の数
x
i
:i番目の甘味処のx座標
y
i
:i番目の甘味処のy座標
v
i
:i番目の甘味処へ移動するときの単位時間あたりの移動距離
である。
Constraints
入力は以下の条件を満たす。
入力はすべて整数。
2 ≤
N
≤ 100
0 ≤
x
i
,
y
i
≤ 100
1 ≤
v
i
≤ 100 ( 1 ≤
i
≤
N
)
x
i
≠
x
j
or
y
i
≠
y
j
( ただし1 ≤
i
<
j
≤
N
)
Output
各テストケースにつき最悪の移動時間の最小値を一行に出力せよ。この値はジャッジ出力の値と10
-5
より大きい差を持ってはならない。
Sample Input
2
1 1 1
2 2 1
4
1 1 3
3 1 3
4 2 1
1 5 3
0
Sample Output
0.70710678
1.06066017

Submitted solutions:

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>
using namespace std;
double EPS = 1e-6;
double add(double a, double b) {
  if (abs(a + b) < EPS * (abs(a) + abs(b)))
    return 0;
  return a + b;
}
struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(const point &p) const { return point(add(x, p.x), add(y, p.y)); }
  point operator-(const point &p) const { return point(add(x, -p.x), add(y, -p.y)); }
  point operator*(double d) const { return point(x * d, y * d); }
  point operator/(double d) const { return point(x / d, y / d); }
};
double dist(const point &a, const point &b) {
  return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}
int main(void) {
  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  while (scanf("%d", &n), n) {
    P.resize(n);
    V.resize(n);
    for (int i = 0; i < n; i++) {
      scanf("%d %d %d", &x, &y, &v);
      P[i] = point(x, y);
      V[i] = v;
    }
    double r = 0.98;
    point now(0, 0);
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0, mxdist;
      for (int j = 0; j < P.size(); j++) {
        mxdist = dist(now, P[j]) / V[j];
        if (mxdist > mxd)
          mx = j, mxd = mxdist;
      }
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    double ans = 0;
    for (int i = 0; i < P.size(); i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 2780
final_rank: 1

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
double EPS = 1e-6;

struct point {
  double x, y, v;
  point() {}
  point(double x, double y, double v) : x(x), y(y), v(v) {}
  point operator+(point p) { return point(x + p.x, y + p.y, v); }
  point operator-(point p) { return point(x - p.x, y - p.y, v); }
  point operator*(double d) { return point(x * d, y * d, v); }
  point operator/(double d) { return point(x / d, y / d, v); }
};

double dist(point a, point b) {
  return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}

int main(void) {
  int n;
  double x, y, v;
  vector<point> P;
  while (cin >> n, n) {
    P.clear();
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P.push_back(point(x, y, v));
    }
    double r = 0.98;
    point now(0, 0, 0);
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      for (int j = 0; j < P.size(); j++) {
        double currentDist = dist(now, P[j]) / P[j].v;
        if (currentDist > mxd)
          mx = j, mxd = currentDist;
      }
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    double ans = 0;
    for (int i = 0; i < P.size(); i++) {
      ans = max(ans, dist(now, P[i]) / P[i].v);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3188
final_rank: 5

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
double EPS = 1e-6;
double add(double a, double b) {
  double sum = a + b;
  if (abs(sum) < EPS * (abs(a) + abs(b)))
    return 0;
  return sum;
}
struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(point p) { return point(add(x, p.x), add(y, p.y)); }
  point operator-(point p) { return point(add(x, -p.x), add(y, -p.y)); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
};
double dist(point a, point b) {
  double dx = a.x - b.x;
  double dy = a.y - b.y;
  return sqrt(dx * dx + dy * dy);
}
int main(void) {
  int n, x, y, v;
  vector<point> P;
  double* V;
  while (cin >> n, n) {
    P.resize(n);
    V = new double[n];
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P[i] = point(x, y);
      V[i] = v;
    }
    double r = 0.98;
    point now(0, 0);
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      for (int j = 0; j < n; j++) {
        double d = dist(now, P[j]) / V[j];
        if (d > mxd) {
          mx = j;
          mxd = d;
        }
      }
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    double ans = 0;
    for (int i = 0; i < n; i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
    delete[] V;
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3208
final_rank: 9

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
double EPS = 1e-6;

double add(double a, double b) {
  double sum = a + b;
  if (fabs(sum) < EPS * (fabs(a) + fabs(b))) {
    return 0;
  }
  return sum;
}

struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(point p) { return point(add(x, p.x), add(y, p.y)); }
  point operator-(point p) { return point(add(x, -p.x), add(y, -p.y)); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
};

double dist(point a, point b) {
  double dx = a.x - b.x;
  double dy = a.y - b.y;
  return sqrt(dx * dx + dy * dy);
}

int main(void) {
  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  while (cin >> n, n) {
    P.clear();
    V.clear();
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P.push_back(point(x, y));
      V.push_back(v);
    }
    double r = 0.98;
    point now(0, 0);
    for (double d = 10; d > EPS; d *= r) {
      double maxDist = 0;
      int maxIndex = 0;
      for (int j = 0; j < P.size(); j++) {
        double distance = dist(now, P[j]) / V[j];
        if (distance > maxDist) {
          maxDist = distance;
          maxIndex = j;
        }
      }
      now = now + ((P[maxIndex] - now) / dist(P[maxIndex], now) * d);
    }
    double ans = 0;
    for (int i = 0; i < P.size(); i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3260
final_rank: 16

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

struct point {
    double x, y;
    point() {}
    point(double x, double y) : x(x), y(y) {}
    point operator+(point p) { return point(x + p.x, y + p.y); }
    point operator-(point p) { return point(x - p.x, y - p.y); }
    point operator*(double d) { return point(x * d, y * d); }
    point operator/(double d) { return point(x / d, y / d); }
};

double dist(point a, point b) {
  return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}

int main(void) {
    const double EPS = 1e-6;
    int n, x, y, v;
    vector<point> P;
    vector<double> V;
    while (cin >> n, n) {
    P.clear();
    V.clear();
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P.push_back(point(x, y));
      V.push_back(v);
    }
    double r = 0.98;
    point now(0, 0);
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      int size = P.size();
      for (int j = 0; j < size; j++) {
        double current_dist = dist(now, P[j]) / V[j];
        if (current_dist > mxd)
          mx = j, mxd = current_dist;
      }
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    double ans = 0;
    int size = P.size();
    for (int i = 0; i < size; i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3188
final_rank: 5

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
double EPS = 1e-6;
double add(double a, double b) {
  if (abs(a + b) < EPS * (abs(a) + abs(b)))
    return 0;
  return a + b;
}
struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(point p) { return point(add(x, p.x), add(y, p.y)); }
  point operator-(point p) { return point(add(x, -p.x), add(y, -p.y)); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
};
double dist(point a, point b) {
  return sqrt((a.x - b.x)*(a.x - b.x) + (a.y - b.y)*(a.y - b.y));
}
int main(void) {
  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  while (cin >> n, n) {
    P.clear();
    V.clear();
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P.push_back(point(x, y));
      V.push_back(v);
    }
    double r = 0.98;
    point now(0, 0);
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      for (int j = 0; j < P.size(); j++){
        double currentDist = dist(now, P[j]) / V[j];
        if (currentDist > mxd)
          mx = j, mxd = currentDist;
      }
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    double ans = 0;
    for (int i = 0; i < P.size(); i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3256
final_rank: 15

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
const double EPS = 1e-6;
double add(double a, double b) {
  if (abs(a + b) < EPS * (abs(a) + abs(b)))
    return 0;
  return a + b;
}
struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(point p) { return point(add(x, p.x), add(y, p.y)); }
  point operator-(point p) { return point(add(x, -p.x), add(y, -p.y)); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
};
double dist(point a, point b) {
  return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}
int main(void) {
  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  while (cin >> n, n) {
    P.clear();
    V.clear();
    P.reserve(n);
    V.reserve(n);
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P.push_back(point(x, y));
      V.push_back(v);
    }
    double r = 0.98;
    point now(0, 0);
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      double tmp;
      int size = P.size();
      for (int j = 0; j < size; j++) {
        tmp = dist(now, P[j]) / V[j];
        if (tmp > mxd)
          mx = j, mxd = tmp;
      }
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    double ans = 0;
    int size = P.size();
    for (int i = 0; i < size; i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3200
final_rank: 8

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
const double EPS = 1e-6;
double add(double a, double b) {
  if (abs(a + b) < EPS * (abs(a) + abs(b)))
    return 0;
  return a + b;
}
struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(point p) { return point(x + p.x, y + p.y); }
  point operator-(point p) { return point(x - p.x, y - p.y); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
};
double dist(point a, point b) {
  return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}
int main(void) {
  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  while (cin >> n, n) {
    P.clear();
    V.clear();
    P.reserve(n);
    V.reserve(n);
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P.push_back(point(x, y));
      V.push_back(v);
    }
    double r = 0.98;
    point now(0, 0);
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      double tmp_d;
      int P_size = P.size();
      for (int j = 0; j < P_size; j++) {
        tmp_d = dist(now, P[j]) / V[j];
        if (tmp_d > mxd)
          mx = j, mxd = tmp_d;
      }
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    double ans = 0;
    int P_size = P.size();
    for (int i = 0; i < P_size; i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3140
final_rank: 2

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

struct point {
  double x, y;
  point(double x, double y) : x(x), y(y) {}
  point operator+(point p) { return point(x + p.x, y + p.y); }
  point operator-(point p) { return point(x - p.x, y - p.y); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
};

double dist(point a, point b) {
  return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}

int main(void) {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  while (cin >> n, n) {
    P.clear();
    V.clear();
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P.push_back(point(x, y));
      V.push_back(v);
    }
    double r = 0.98;
    point now(0, 0);
    for (double d = 10; d > 1e-6; d *= r) {
      int mx = 0;
      double mxd = 0;
      for (int j = 0; j < P.size(); j++) {
        double current_dist = dist(now, P[j]) / V[j];
        if (current_dist > mxd)
          mx = j, mxd = current_dist;
      }
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    double ans = 0;
    for (int i = 0; i < P.size(); i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3284
final_rank: 18

code_snippet: #include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

const double EPS = 1e-6;

struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(point p) { return point(x + p.x, y + p.y); }
  point operator-(point p) { return point(x - p.x, y - p.y); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
};

double dist(point a, point b) {
  double dx = a.x - b.x;
  double dy = a.y - b.y;
  return sqrt(dx * dx + dy * dy);
}

int main(void) {
  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  
  P.reserve(1000); // Reserve memory for P vector
  V.reserve(1000); // Reserve memory for V vector

  while (cin >> n, n) {
    P.clear();
    V.clear();
    
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P.push_back(point(x, y));
      V.push_back(v);
    }
    
    double r = 0.98;
    point now(0, 0);
    
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      
      for (int j = 0; j < P.size(); j++) {
        double currentDist = dist(now, P[j]);
        double time = currentDist / V[j];
        
        if (time > mxd) {
          mx = j;
          mxd = time;
        }
      }
      
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    
    double ans = 0;
    
    for (int i = 0; i < P.size(); i++) {
      double currentDist = dist(now, P[i]);
      double time = currentDist / V[i];
      
      ans = max(ans, time);
    }
    
    printf("%.8f\n", ans);
  }
  
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3168
final_rank: 3

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
double EPS = 1e-6;

double add(double a, double b) {
  double abs_a = abs(a);
  double abs_b = abs(b);
  if (abs(a + b) < EPS * (abs_a + abs_b))
    return 0;
  return a + b;
}

struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(point p) { return point(add(x, p.x), add(y, p.y)); }
  point operator-(point p) { return point(add(x, -p.x), add(y, -p.y)); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
};

double dist(point a, point b) {
  double dx = a.x - b.x;
  double dy = a.y - b.y;
  return sqrt(dx * dx + dy * dy);
}

int main(void) {
  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  
  while (cin >> n, n) {
    P.resize(n);
    V.resize(n);
    
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P[i] = point(x, y);
      V[i] = v;
    }
    
    double r = 0.98;
    point now(0, 0);
    
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      
      for (int j = 0; j < n; j++) {
        double cur_dist = dist(now, P[j]) / V[j];
        if (cur_dist > mxd) {
          mx = j;
          mxd = cur_dist;
        }
      }
      
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    
    double ans = 0;
    
    for (int i = 0; i < n; i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    
    printf("%.8f\n", ans);
  }
  
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3176
final_rank: 4

code_snippet: #include <iostream>
#include <vector>
#include <cmath>

using namespace std;

const double EPS = 1e-6;

double add(double a, double b) {
    if (abs(a + b) < EPS * (abs(a) + abs(b)))
        return 0;
    return a + b;
}

struct point {
    double x, y;
    point() {}
    point(double x, double y) : x(x), y(y) {}
    point operator+(point p) { return point(add(x, p.x), add(y, p.y)); }
    point operator-(point p) { return point(add(x, -p.x), add(y, -p.y)); }
    point operator*(double d) { return point(x * d, y * d); }
    point operator/(double d) { return point(x / d, y / d); }
};

double dist(point a, point b) {
    return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}

int main(void) {
    int n, x, y, v;
    vector<point> P;
    vector<double> V;
    
    while (cin >> n, n) {
        P.resize(n);
        V.resize(n);
        
        for (int i = 0; i < n; i++) {
            cin >> x >> y >> v;
            P[i] = point(x, y);
            V[i] = v;
        }
        
        double r = 0.98;
        point now(0, 0);
        
        for (double d = 10; d > EPS; d *= r) {
            int mx = 0;
            double mxd = 0;
            
            for (int j = 0; j < P.size(); j++) {
                double currDist = dist(now, P[j]) / V[j];
                
                if (currDist > mxd) {
                    mx = j;
                    mxd = currDist;
                }
            }
            
            now = now + ((P[mx] - now) / dist(P[mx], now) * d);
        }
        
        double ans = 0;
        
        for (int i = 0; i < P.size(); i++) {
            ans = max(ans, dist(now, P[i]) / V[i]);
        }
        
        cout.precision(8);
        cout << fixed << ans << endl;
    }
    
    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3284
final_rank: 18

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
double EPS = 1e-6;
double add(double a, double b) {
  if (abs(a + b) < EPS * (abs(a) + abs(b)))
    return 0;
  return a + b;
}
struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(point p) { return point(add(x, p.x), add(y, p.y)); }
  point operator-(point p) { return point(add(x, -p.x), add(y, -p.y)); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
};
double dist(point a, point b) {
  return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}
int main(void) {
  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  while (cin >> n, n) {
    P.clear();
    V.clear();
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P.push_back(point(x, y));
      V.push_back(v);
    }
    double r = 0.975;
    point now(0, 0);
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      for (int j = 0; j < P.size(); j++)
        if (dist(now, P[j]) / V[j] > mxd)
          mx = j, mxd = dist(now, P[j]) / V[j];
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    double ans = 0;
    for (int i = 0; i < P.size(); i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3244
final_rank: 10

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
double EPS = 1e-6;
double add(double a, double b) {
  if (abs(a + b) < EPS * (abs(a) + abs(b)))
    return 0;
  return a + b;
}
struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(point p) { return point(add(x, p.x), add(y, p.y)); }
  point operator-(point p) { return point(add(x, -p.x), add(y, -p.y)); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
};
double dist(point a, point b) {
  return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}
int main(void) {
  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  while (cin >> n, n) {
    P.clear();
    V.clear();
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P.push_back(point(x, y));
      V.push_back(v);
    }
    double r = 0.98;
    point now(0, 0);
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      for (int j = 0; j < P.size(); j++)
        if (dist(now, P[j]) / V[j] > mxd)
          mx = j, mxd = dist(now, P[j]) / V[j];
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    double ans = 0;
    for (int i = 0; i < P.size(); i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3248
final_rank: 12

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

double EPS = 1e-6;

inline double add(double a, double b) {
  if (fabs(a + b) < EPS * (fabs(a) + fabs(b)))
    return 0;
  return a + b;
}

struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(const point& p) const { return point(add(x, p.x), add(y, p.y)); }
  point operator-(const point& p) const { return point(add(x, -p.x), add(y, -p.y)); }
  point operator*(const double d) const { return point(x * d, y * d); }
  point operator/(const double d) const { return point(x / d, y / d); }
};

inline double dist(const point& a, const point& b) {
  const double dx = a.x - b.x, dy = a.y - b.y;
  return sqrt(dx*dx + dy*dy);
}

int main(void) {
  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  while (scanf("%d", &n), n) {
    P.resize(n);
    V.resize(n);
    for (int i = 0; i < n; i++) {
      scanf("%d %d %d", &x, &y, &v);
      P[i] = point(x, y);
      V[i] = v;
    }
    double r = 0.98;
    point now(0, 0);
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      for (int j = 0; j < n; j++) {
        const double cur_dist = dist(now, P[j]);
        const double cur_time = cur_dist / V[j];
        if (cur_time > mxd) {
          mx = j;
          mxd = cur_time;
        }
      }
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    double ans = 0;
    for (int i = 0; i < n; i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3272
final_rank: 17

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
const double EPS = 1e-6;
inline double add(double a, double b) {
  return (abs(a + b) < EPS * (abs(a) + abs(b))) ? 0 : a + b;
}
struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  inline point operator+(const point &p) const { return point(add(x, p.x), add(y, p.y)); }
  inline point operator-(const point &p) const { return point(add(x, -p.x), add(y, -p.y)); }
  inline point operator*(double d) const { return point(x * d, y * d); }
  inline point operator/(double d) const { return point(x / d, y / d); }
  inline double dist(const point &p) const { return hypot(x - p.x, y - p.y); }
};
int main(void) {
  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  while (cin >> n, n) {
    P.resize(n);
    V.resize(n);
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P[i] = point(x, y);
      V[i] = v;
    }
    double r = 0.98;
    point now(0, 0);
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      for (int j = 0; j < n; j++)
        if (now.dist(P[j]) / V[j] > mxd)
          mx = j, mxd = now.dist(P[j]) / V[j];
      now = now + ((P[mx] - now) / now.dist(P[mx]) * d);
    }
    double ans = 0;
    for (int i = 0; i < n; i++) {
      ans = max(ans, now.dist(P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3252
final_rank: 14

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

const double EPS = 1e-6;

inline double add(double a, double b) {
  if (abs(a + b) < EPS * (abs(a) + abs(b)))
    return 0;
  return a + b;
}

struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(const point& p) const { return point(add(x, p.x), add(y, p.y)); }
  point operator-(const point& p) const { return point(add(x, -p.x), add(y, -p.y)); }
  point operator*(const double& d) const { return point(x * d, y * d); }
  point operator/(const double& d) const { return point(x / d, y / d); }
};

inline double dist(const point& a, const point& b) {
  double dx = a.x - b.x, dy = a.y - b.y;
  return sqrt(dx*dx + dy*dy);
}

int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  while (cin >> n, n) {
    P.resize(n);
    V.resize(n);
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P[i] = point(x, y);
      V[i] = v;
    }
    double r = 0.98;
    point now(0, 0);
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      for (int j = 0; j < n; j++) {
        double tmp = dist(now, P[j]) / V[j];
        if (tmp > mxd)
          mx = j, mxd = tmp;
      }
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    double ans = 0;
    for (int i = 0; i < n; i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3248
final_rank: 12

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

const double EPS = 1e-6;

inline double add(double a, double b) {
  return abs(a + b) < EPS * (abs(a) + abs(b)) ? 0 : a + b;
}

struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(point p) { return point(add(x, p.x), add(y, p.y)); }
  point operator-(point p) { return point(add(x, -p.x), add(y, -p.y)); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
};

inline double dist(point a, point b) {
  double dx = a.x - b.x;
  double dy = a.y - b.y;
  return sqrt(dx*dx + dy*dy);
}

int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n, x, y, v;
  while (cin >> n, n) {
    vector<point> P(n);
    vector<double> V(n);
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P[i] = point(x, y);
      V[i] = v;
    }
    double r = 0.98;
    point now(0, 0);
    double d = 10;
    while (d > EPS) {
      int mx = 0;
      double mxd = 0;
      for (int j = 0; j < n; j++) {
        double tmp = dist(now, P[j]) / V[j];
        if (tmp > mxd) {
          mx = j;
          mxd = tmp;
        }
      }
      point dir = P[mx] - now;
      double norm = dist(P[mx], now);
      dir = dir / norm;
      dir = dir * d;
      now = now + dir;
      d *= r;
    }
    double ans = 0;
    for (int i = 0; i < n; i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3188
final_rank: 5

code_snippet: #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
double EPS = 1e-6;
double add(double a, double b) {
  if (abs(a + b) < EPS * (abs(a) + abs(b)))
    return 0;
  return a + b;
}
struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(point p) { return point(add(x, p.x), add(y, p.y)); }
  point operator-(point p) { return point(add(x, -p.x), add(y, -p.y)); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
};
double dist(point a, point b) {
  return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, x, y, v;
  vector<point> P;
  vector<double> V;
  while (cin >> n, n) {
    P.resize(n);
    V.resize(n);
    for (int i = 0; i < n; i++) {
      cin >> x >> y >> v;
      P[i] = point(x, y);
      V[i] = v;
    }
    double r = 0.98;
    point now(0, 0);
    for (double d = 10; d > EPS; d *= r) {
      int mx = 0;
      double mxd = 0;
      for (int j = 0; j < n; j++)
        if (dist(now, P[j]) / V[j] > mxd)
          mx = j, mxd = dist(now, P[j]) / V[j];
      now = now + ((P[mx] - now) / dist(P[mx], now) * d);
    }
    double ans = 0;
    for (int i = 0; i < n; i++) {
      ans = max(ans, dist(now, P[i]) / V[i]);
    }
    printf("%.8f\n", ans);
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3244
final_rank: 10