ARC004 A The Longest Distance
Table of contents
# Problem
https://atcoder.jp/contests/arc004/tasks/arc004_1
Given N 2D points, report the longest distance of 2 of them.
# Explanation
As N is enough smaill, the number of calculation steps is , which means it finishes within 1 second.
# Time complexity
# Solution
#define MAX_N 101
Int N;
Vector2 points[MAX_N];
void input() {
cin >> N;
loop(n,0,N) cin >> points[n];
}
void solve() {
double max_ = -1;
loop(i,0,N-1) {
loop(j,i+1,N) {
max_ = fmax(max_, (points[i] - points[j]).length());
}
}
cout << max_ << endl;
}
int main(void) {
input();
solve();
}
Shun
Remote freelancer. A web and mobile application enginner.
Traveling around the world based on East Asia.
I'm looking forward to your job offers from all over the world!