# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
197871 | 2u_my_light | 개미 (GA4_ant) | Java | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader();
StringBuilder out = new StringBuilder();
int T = in.nextInt();
while (T-- > 0) {
long a = in.nextInt();
long b = in.nextInt();
long c = in.nextInt();
long min = Integer.MAX_VALUE;
min = Math.min(min, a * a + (b + c) * (b + c));
min = Math.min(min, b * b + (c + a) * (c + a));
min = Math.min(min, c * c + (a + b) * (a + b));
out.append(min + "\n");
}
System.out.print(out);
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer st;
public InputReader() {
reader = new BufferedReader(new InputStreamReader(System.in));
}
public String next() {
while (st == null || !st.hasMoreTokens()) {
st = new StringTokenizer(nextLine());
}
return st.nextToken();
}
public String nextLine() {
try {
return reader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public int nextInt() {
return Integer.parseInt(next());
}
}
}