結果

問題 No.998 Four Integers
ユーザー tenten
提出日時 2020-08-24 17:19:17
言語 Java
(openjdk 23)
結果
AC  
実行時間 138 ms / 1,000 ms
コード長 467 bytes
コンパイル時間 3,541 ms
コンパイル使用メモリ 74,416 KB
実行使用メモリ 54,368 KB
最終ジャッジ日時 2024-11-06 10:27:47
合計ジャッジ時間 6,596 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = new int[4];
        for (int i = 0; i < 4; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        if (arr[0] + 1 == arr[1] && arr[1] + 1 == arr[2] && arr[2] + 1 == arr[3]) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}
0