結果

問題 No.998 Four Integers
ユーザー kurashitakazuhirokurashitakazuhiro
提出日時 2020-03-21 18:34:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 119 ms / 1,000 ms
コード長 546 bytes
コンパイル時間 5,601 ms
コンパイル使用メモリ 94,296 KB
実行使用メモリ 40,140 KB
最終ジャッジ日時 2023-08-24 21:28:16
合計ジャッジ時間 7,389 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
39,012 KB
testcase_01 AC 118 ms
39,096 KB
testcase_02 AC 117 ms
39,268 KB
testcase_03 AC 118 ms
40,140 KB
testcase_04 AC 117 ms
39,604 KB
testcase_05 AC 117 ms
39,208 KB
testcase_06 AC 117 ms
39,540 KB
testcase_07 AC 116 ms
39,484 KB
testcase_08 AC 117 ms
39,388 KB
testcase_09 AC 118 ms
39,376 KB
testcase_10 AC 117 ms
39,664 KB
testcase_11 AC 118 ms
39,300 KB
testcase_12 AC 117 ms
39,260 KB
testcase_13 AC 116 ms
39,788 KB
testcase_14 AC 117 ms
39,056 KB
testcase_15 AC 118 ms
39,076 KB
testcase_16 AC 117 ms
39,276 KB
testcase_17 AC 118 ms
39,392 KB
testcase_18 AC 116 ms
39,332 KB
testcase_19 AC 117 ms
39,452 KB
testcase_20 AC 115 ms
39,672 KB
testcase_21 AC 119 ms
38,964 KB
testcase_22 AC 117 ms
39,748 KB
testcase_23 AC 118 ms
39,208 KB
testcase_24 AC 115 ms
38,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.Collections;
import java.util.stream.Collectors;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<Integer>();
    for (int i = 0; i < 4; i++) {
      list.add(sc.nextInt());
    }
    Collections.sort(list);
    if (list.get(0) + 1 == list.get(1) && list.get(1) + 1 == list.get(2) && list.get(2) + 1 == list.get(3)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}
0