結果
問題 | No.998 Four Integers |
ユーザー | devtatuo |
提出日時 | 2020-05-05 07:58:49 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 61 ms / 1,000 ms |
コード長 | 1,229 bytes |
コンパイル時間 | 2,968 ms |
コンパイル使用メモリ | 79,128 KB |
実行使用メモリ | 51,476 KB |
最終ジャッジ日時 | 2023-09-08 06:21:48 |
合計ジャッジ時間 | 5,914 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 58 ms
50,648 KB |
testcase_01 | AC | 56 ms
51,476 KB |
testcase_02 | AC | 56 ms
49,000 KB |
testcase_03 | AC | 58 ms
51,020 KB |
testcase_04 | AC | 58 ms
51,256 KB |
testcase_05 | AC | 58 ms
50,584 KB |
testcase_06 | AC | 57 ms
51,024 KB |
testcase_07 | AC | 58 ms
50,748 KB |
testcase_08 | AC | 57 ms
50,516 KB |
testcase_09 | AC | 59 ms
50,940 KB |
testcase_10 | AC | 58 ms
51,292 KB |
testcase_11 | AC | 59 ms
51,000 KB |
testcase_12 | AC | 59 ms
51,128 KB |
testcase_13 | AC | 58 ms
51,260 KB |
testcase_14 | AC | 59 ms
51,072 KB |
testcase_15 | AC | 59 ms
50,992 KB |
testcase_16 | AC | 60 ms
50,640 KB |
testcase_17 | AC | 59 ms
51,300 KB |
testcase_18 | AC | 58 ms
51,268 KB |
testcase_19 | AC | 58 ms
50,672 KB |
testcase_20 | AC | 59 ms
50,948 KB |
testcase_21 | AC | 58 ms
49,564 KB |
testcase_22 | AC | 61 ms
50,752 KB |
testcase_23 | AC | 59 ms
50,604 KB |
testcase_24 | AC | 60 ms
51,052 KB |
ソースコード
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Stream; public class Main { public static void main(String[] args) throws Exception { InputStreamReader is = new InputStreamReader(System.in); BufferedReader reader = new BufferedReader(is); List<String> mylist = new ArrayList<>(); // 標準入力からの値を変数strinputに代入 String strinput = reader.readLine(); while (strinput != null) { mylist.add(strinput); strinput = reader.readLine(); } String arr[] = mylist.get(0).split(" "); Stream<String> stream = Arrays.stream(arr); int arr02[] = stream.mapToInt(Integer::parseInt).toArray(); int l = arr.length; Arrays.sort(arr02); Boolean chkflg = true; for (int i = 0; i < l - 1; i++) { int a = Integer.valueOf(arr02[i]); int b = Integer.valueOf(arr02[i + 1]); if (b - a != 1) { chkflg = false; break; } } System.out.println(chkflg ? "Yes" : "No"); } }