結果
問題 | No.2790 Athena 3 |
ユーザー | tenten |
提出日時 | 2024-06-24 10:45:11 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 64 ms / 2,000 ms |
コード長 | 2,470 bytes |
コンパイル時間 | 4,601 ms |
コンパイル使用メモリ | 78,680 KB |
実行使用メモリ | 37,276 KB |
最終ジャッジ日時 | 2024-06-24 10:45:18 |
合計ジャッジ時間 | 4,806 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 64 ms
36,876 KB |
testcase_01 | AC | 52 ms
36,924 KB |
testcase_02 | AC | 53 ms
36,784 KB |
testcase_03 | AC | 53 ms
37,232 KB |
testcase_04 | AC | 53 ms
36,812 KB |
testcase_05 | AC | 55 ms
36,980 KB |
testcase_06 | AC | 53 ms
36,764 KB |
testcase_07 | AC | 52 ms
37,244 KB |
testcase_08 | AC | 53 ms
37,216 KB |
testcase_09 | AC | 54 ms
36,816 KB |
testcase_10 | AC | 52 ms
36,680 KB |
testcase_11 | AC | 53 ms
37,004 KB |
testcase_12 | AC | 54 ms
37,276 KB |
testcase_13 | AC | 52 ms
36,816 KB |
testcase_14 | AC | 53 ms
36,888 KB |
testcase_15 | AC | 52 ms
37,040 KB |
testcase_16 | AC | 54 ms
37,208 KB |
ソースコード
import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); Point[] points = new Point[3]; for (int i = 0; i < 3; i++) { points[i] = new Point(sc.nextInt(), sc.nextInt()); } Point[] pattern = new Point[]{new Point(1, 0), new Point(-1, 0), new Point(0, 1), new Point(0, -1)}; double ans = 0; for (int i = 0; i < 4; i++) { points[0].add(pattern[i]); for (int j = 0; j < 4; j++) { points[1].add(pattern[j]); for (int k = 0; k < 4; k++) { points[2].add(pattern[k]); ans = Math.max(ans, points[0].getSpace(points[1], points[2])); points[2].draw(pattern[k]); } points[1].draw(pattern[j]); } points[0].draw(pattern[i]); } System.out.println(ans); } static class Point { double x; double y; public Point(double x, double y) { this.x = x; this.y = y; } public void add(Point p) { x += p.x; y += p.y; } public void draw(Point p) { x -= p.x; y -= p.y; } public double getSpace(Point p1, Point p2) { double ans = (p1.x - x) * (p2.y - y) - (p1.y - y) * (p2.x - x); return Math.abs(ans) / 2; } } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }