結果
| 問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-11-19 22:37:38 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 737 bytes |
| コンパイル時間 | 3,394 ms |
| コンパイル使用メモリ | 82,496 KB |
| 実行使用メモリ | 43,636 KB |
| 最終ジャッジ日時 | 2025-01-02 19:22:04 |
| 合計ジャッジ時間 | 7,643 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 WA * 3 |
ソースコード
import java.util.Scanner;
public class Yukicoder55 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] x = new int[4];
int[] y = new int[4];
int[][] pat = {{0, 1, 2}, {1, 0, 2}, {2, 0, 1}};
for (int i = 0; i < 3; i++) {
x[i] = sc.nextInt();
y[i] = sc.nextInt();
}
for (int i = 0; i < 3; i++) {
if (Math.hypot(x[pat[i][1]] - x[pat[i][0]], y[pat[i][1]] - y[pat[i][0]]) == Math.hypot(x[pat[i][2]] - x[pat[i][0]], y[pat[i][2]] - y[pat[i][0]])) {
x[3] = x[pat[i][1]] + (x[pat[i][2]] - x[pat[i][0]]);
y[3] = y[pat[i][1]] + (y[pat[i][2]] - y[pat[i][0]]);
System.out.println(x[3] + " " + y[3]);
return;
}
}
System.out.println("-1");
}
}