結果
| 問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-04-14 08:31:50 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 156 ms / 5,000 ms |
| コード長 | 831 bytes |
| コンパイル時間 | 2,179 ms |
| コンパイル使用メモリ | 79,372 KB |
| 実行使用メモリ | 54,968 KB |
| 最終ジャッジ日時 | 2024-11-14 13:54:42 |
| 合計ジャッジ時間 | 6,648 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int x1, y1, x2, y2, x3, y3;
x1 = scanner.nextInt();
y1 = scanner.nextInt();
x2 = scanner.nextInt();
y2 = scanner.nextInt();
x3 = scanner.nextInt();
y3 = scanner.nextInt();
if (f(x1, y1, x2, y2, x3, y3) || f(x1, y1, x3, y3, x2, y2) || f(x2, y2, x1, y1, x3, y3)
|| f(x2, y2, x3, y3, x1, y1) || f(x3, y3, x2, y2, x1, y1) || f(x3, y3, x1, y1, x2, y2)) {
} else {
System.out.println(-1);
}
}
private static boolean f(int x1, int y1, int x2, int y2, int x3, int y3) {
int dx = x2 - x1;
int dy = y2 - y1;
if (y3 == y2 + dx && x3 == x2 - dy) {
int x4 = x3 - dx;
int y4 = y3 - dy;
System.out.println(x4 + " " + y4);
return true;
}
return false;
}
}