結果
| 問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-11-03 01:33:01 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 157 ms / 5,000 ms |
| コード長 | 659 bytes |
| コンパイル時間 | 2,387 ms |
| コンパイル使用メモリ | 79,288 KB |
| 実行使用メモリ | 55,176 KB |
| 最終ジャッジ日時 | 2024-11-14 13:41:55 |
| 合計ジャッジ時間 | 6,598 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
import java.util.*;
public class Main {
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 x1=x[i%3];
int y1=y[i%3];
int x2=x[(i+1)%3];
int y2=y[(i+1)%3];
int x3=x[(i+2)%3];
int y3=y[(i+2)%3];
if(Math.hypot(x1-x2,y1-y2)==Math.hypot(x2-x3,y2-y3)){
if((x1-x2)*(x2-x3)+(y1-y2)*(y2-y3)==0){
int ansx=x3+x1-x2;
int ansy=y3+y1-y2;
System.out.println(ansx+" "+ansy);
return;
}
}
}
System.out.println(-1);}
}