結果
問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
ユーザー | scache |
提出日時 | 2014-11-26 20:41:35 |
言語 | Java21 (openjdk 21) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 909 bytes |
コンパイル時間 | 3,671 ms |
コンパイル使用メモリ | 80,584 KB |
実行使用メモリ | 54,756 KB |
最終ジャッジ日時 | 2024-04-16 22:19:31 |
合計ジャッジ時間 | 7,960 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 156 ms
42,304 KB |
testcase_01 | AC | 129 ms
41,592 KB |
testcase_02 | AC | 157 ms
42,320 KB |
testcase_03 | AC | 158 ms
42,684 KB |
testcase_04 | WA | - |
testcase_05 | AC | 128 ms
41,384 KB |
testcase_06 | AC | 131 ms
41,340 KB |
testcase_07 | AC | 130 ms
41,348 KB |
testcase_08 | AC | 132 ms
41,572 KB |
testcase_09 | AC | 129 ms
41,312 KB |
testcase_10 | AC | 116 ms
40,292 KB |
testcase_11 | AC | 154 ms
42,468 KB |
testcase_12 | AC | 127 ms
41,360 KB |
testcase_13 | AC | 155 ms
42,672 KB |
testcase_14 | AC | 154 ms
42,304 KB |
testcase_15 | AC | 128 ms
41,680 KB |
testcase_16 | AC | 152 ms
42,580 KB |
testcase_17 | AC | 114 ms
40,348 KB |
testcase_18 | AC | 153 ms
42,680 KB |
testcase_19 | AC | 130 ms
41,104 KB |
testcase_20 | AC | 152 ms
42,536 KB |
testcase_21 | AC | 155 ms
42,716 KB |
testcase_22 | AC | 139 ms
42,124 KB |
testcase_23 | AC | 151 ms
42,684 KB |
testcase_24 | AC | 154 ms
42,160 KB |
ソースコード
import java.util.Scanner; public class Main55 { public static void main(String[] args) { Main55 p = new Main55(); } public Main55() { 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(); } solve(x, y); } public void solve(int[] x, int[] y) { String res = ""; for(int i=0;i<3;i++){ if((res = isOk(x[i], y[i], x[(i+1)%3], y[(i+1)%3], x[(i+2)%3], y[(i+2)%3])) != null){ System.out.println(res); return; } } System.out.println("-1"); } private String isOk(int x1, int y1, int x2, int y2, int x3, int y3){ int vx1 = x1-x2; int vx2 = x3-x2; int vy1 = y1-y2; int vy2 = y3-y2; if(vx1*vy1+vx2*vy2==0 && (vx1*vx1+vy1*vy1) == (vx2*vx2+vy2*vy2)) return (x2+vx1+vx2) + " " + (y2+vy1+vy2); else return null; } }