結果

問題 No.998 Four Integers
ユーザー Yosuke YamaguchiYosuke Yamaguchi
提出日時 2021-02-08 09:48:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 1,000 ms
コード長 710 bytes
コンパイル時間 4,399 ms
コンパイル使用メモリ 76,360 KB
実行使用メモリ 56,196 KB
最終ジャッジ日時 2023-09-18 15:31:26
合計ジャッジ時間 8,804 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,796 KB
testcase_01 AC 125 ms
55,368 KB
testcase_02 AC 123 ms
55,948 KB
testcase_03 AC 122 ms
55,596 KB
testcase_04 AC 122 ms
55,624 KB
testcase_05 AC 123 ms
55,984 KB
testcase_06 AC 122 ms
55,600 KB
testcase_07 AC 122 ms
55,604 KB
testcase_08 AC 124 ms
55,680 KB
testcase_09 AC 125 ms
55,668 KB
testcase_10 AC 123 ms
55,824 KB
testcase_11 AC 121 ms
56,184 KB
testcase_12 AC 122 ms
56,020 KB
testcase_13 AC 124 ms
55,716 KB
testcase_14 AC 123 ms
55,580 KB
testcase_15 AC 123 ms
55,712 KB
testcase_16 AC 124 ms
55,648 KB
testcase_17 AC 121 ms
56,196 KB
testcase_18 AC 121 ms
56,004 KB
testcase_19 AC 122 ms
55,528 KB
testcase_20 AC 123 ms
55,464 KB
testcase_21 AC 123 ms
55,636 KB
testcase_22 AC 122 ms
55,780 KB
testcase_23 AC 125 ms
55,640 KB
testcase_24 AC 123 ms
55,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

// https://yukicoder.me/problems/no/998
public class FourIntegers998 {
  public static void main(String[] args) {
    // 標準入力から読み込む際に、Scan
    Scanner sc = new Scanner(System.in);
    List<Integer> forIntegerList = new ArrayList<Integer>();
    for (int i = 0; i < 4; i++) {
      forIntegerList.add(Integer.parseInt(sc.next()));
    }
    Collections.sort(forIntegerList);
    for (int i = 0; i < 3; i++) {
      if (forIntegerList.get(i) + 1 != forIntegerList.get(i + 1)) {
        System.out.println("No");
        return;
      }
    }
    System.out.println("Yes");
  }
}
0