結果

問題 No.1285 ゴミ捨て
ユーザー キョウチクキョウチク
提出日時 2022-05-16 15:13:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 634 ms / 2,000 ms
コード長 697 bytes
コンパイル時間 3,790 ms
コンパイル使用メモリ 72,588 KB
実行使用メモリ 52,616 KB
最終ジャッジ日時 2023-10-12 08:09:21
合計ジャッジ時間 16,184 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
39,468 KB
testcase_01 AC 118 ms
39,632 KB
testcase_02 AC 121 ms
39,116 KB
testcase_03 AC 121 ms
40,088 KB
testcase_04 AC 118 ms
39,224 KB
testcase_05 AC 123 ms
39,568 KB
testcase_06 AC 123 ms
39,012 KB
testcase_07 AC 557 ms
50,020 KB
testcase_08 AC 204 ms
43,496 KB
testcase_09 AC 418 ms
44,956 KB
testcase_10 AC 549 ms
52,616 KB
testcase_11 AC 595 ms
51,848 KB
testcase_12 AC 525 ms
47,872 KB
testcase_13 AC 528 ms
48,948 KB
testcase_14 AC 634 ms
50,320 KB
testcase_15 AC 573 ms
49,216 KB
testcase_16 AC 365 ms
45,180 KB
testcase_17 AC 351 ms
44,852 KB
testcase_18 AC 336 ms
45,336 KB
testcase_19 AC 437 ms
46,848 KB
testcase_20 AC 311 ms
44,828 KB
testcase_21 AC 357 ms
45,300 KB
testcase_22 AC 551 ms
51,480 KB
testcase_23 AC 565 ms
51,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Test10 {
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String line;
    line=sc.nextLine();
    int n=Integer.parseInt(line);
    int[] cups=new int[n+1];
    for(int i=0;i<n;i++){
      line=sc.nextLine();
      cups[i]=Integer.parseInt(line);
    }
    cups[n]=Integer.MAX_VALUE;
    Arrays.sort(cups);
    int max=0;
    while(cups[0]<Integer.MAX_VALUE){
      max++;
      int tmp=0;
      for(int i=0;cups[i]<Integer.MAX_VALUE;i++){
        if(tmp<cups[i]){
          tmp=cups[i]+1;
          cups[i]=Integer.MAX_VALUE;
        }
      }
      Arrays.sort(cups);
    }
    System.out.println(max);
    sc.close();
  }
}
0