結果

問題 No.208 王将
ユーザー htensaihtensai
提出日時 2019-12-19 14:37:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 45 ms / 1,000 ms
コード長 864 bytes
コンパイル時間 2,205 ms
コンパイル使用メモリ 74,880 KB
実行使用メモリ 49,604 KB
最終ジャッジ日時 2023-09-21 06:45:34
合計ジャッジ時間 4,233 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,184 KB
testcase_01 AC 45 ms
49,260 KB
testcase_02 AC 44 ms
49,380 KB
testcase_03 AC 44 ms
49,228 KB
testcase_04 AC 44 ms
49,448 KB
testcase_05 AC 44 ms
49,288 KB
testcase_06 AC 44 ms
49,192 KB
testcase_07 AC 45 ms
49,524 KB
testcase_08 AC 44 ms
49,392 KB
testcase_09 AC 44 ms
49,576 KB
testcase_10 AC 43 ms
49,604 KB
testcase_11 AC 43 ms
49,160 KB
testcase_12 AC 44 ms
49,364 KB
testcase_13 AC 44 ms
49,496 KB
testcase_14 AC 44 ms
49,444 KB
testcase_15 AC 44 ms
49,268 KB
testcase_16 AC 43 ms
49,248 KB
testcase_17 AC 44 ms
49,216 KB
testcase_18 AC 45 ms
49,292 KB
testcase_19 AC 44 ms
49,460 KB
testcase_20 AC 43 ms
49,220 KB
testcase_21 AC 45 ms
49,216 KB
testcase_22 AC 44 ms
49,380 KB
testcase_23 AC 44 ms
49,468 KB
testcase_24 AC 44 ms
49,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Main {
    static HashSet<Integer>[] graph;
    static int n;
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] first = br.readLine().split(" ", 2);
        int x1 = Integer.parseInt(first[0]);
        int y1 = Integer.parseInt(first[1]);
        String[] second = br.readLine().split(" ", 2);
        int x2 = Integer.parseInt(second[0]);
        int y2 = Integer.parseInt(second[1]);
        if (Math.abs(x1) == Math.abs(y1) && Math.abs(x2) == Math.abs(y2) && Math.abs(x1) > Math.abs(x2) && (long)x1 * (long)x2 > 0 && (long)y1 * (long)y2 > 0) {
            System.out.println(Math.abs(x1) + 1);
        } else {
            System.out.println(Math.max(Math.abs(x1), Math.abs(y1)));
        }
    }
}
0