結果
| 問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-11-03 20:06:08 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 137 ms / 5,000 ms |
| コード長 | 1,063 bytes |
| コンパイル時間 | 3,365 ms |
| コンパイル使用メモリ | 77,796 KB |
| 実行使用メモリ | 54,332 KB |
| 最終ジャッジ日時 | 2024-11-14 13:52:21 |
| 合計ジャッジ時間 | 7,703 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
import java.util.Scanner;
public class Main_yukicoder55 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] x = new int[3];
int[] y = new int[3];
for (int i = 0; i < 3; i++) {
x[i] = sc.nextInt();
y[i] = sc.nextInt();
}
for (int i = 0; i < 3; i++) {
int xx1 = x[(i + 1) % 3] - x[i];
int yy1 = y[(i + 1) % 3] - y[i];
int xx2 = x[(i + 2) % 3] - x[i];
int yy2 = y[(i + 2) % 3] - y[i];
if (Geom.dot(xx1, yy1, xx2, yy2) == 0 && Geom.sumofsquare(xx1, yy1) == Geom.sumofsquare(xx2, yy2)) {
System.out.printf("%d %d\n", xx1 + xx2 + x[i], yy1 + yy2 + y[i]);
sc.close();
return;
}
}
System.out.println("-1");
sc.close();
}
private static class Geom {
static int dot(int xa, int ya, int xb, int yb) {
return xa * xb + ya * yb;
}
static int sumofsquare(int xa, int ya) {
return xa * xa + ya * ya;
}
}
}