結果

問題 No.1285 ゴミ捨て
ユーザー AsahiAsahi
提出日時 2023-02-09 05:20:40
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 726 bytes
コンパイル時間 3,233 ms
コンパイル使用メモリ 73,060 KB
実行使用メモリ 61,856 KB
最終ジャッジ日時 2023-09-20 16:59:22
合計ジャッジ時間 13,691 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,808 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 122 ms
55,668 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 623 ms
61,856 KB
testcase_08 WA -
testcase_09 AC 444 ms
60,720 KB
testcase_10 AC 580 ms
60,904 KB
testcase_11 AC 567 ms
60,376 KB
testcase_12 AC 497 ms
60,744 KB
testcase_13 AC 487 ms
60,580 KB
testcase_14 AC 590 ms
60,748 KB
testcase_15 AC 524 ms
60,552 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 424 ms
60,544 KB
testcase_20 WA -
testcase_21 AC 387 ms
60,384 KB
testcase_22 AC 605 ms
61,668 KB
testcase_23 AC 615 ms
61,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;
import java.util.stream.Stream;

public class Main{
    static  PrintWriter output;
    static  Scanner sc;
    static int cnt ;
    static void solve() {
        int n = sc.nextInt();
        int [] cup = new int[n];
        for(int i=0;i<n;i++) cup[i] = sc.nextInt();
        Arrays.sort(cup);
        int ans = 1;
        for(int i=0;i<n-1;i++) {
            if(cup[i] + 1 < cup[i+1]) {
                ans = 2;
            }
        }
        output.print(ans);
    }

    public static void main(String[] args) throws IOException{
        output = new PrintWriter(System.out);
        sc = new Scanner(System.in);
        solve();
        output.flush();
    }
}
0