結果
| 問題 |
No.1285 ゴミ捨て
|
| コンテスト | |
| ユーザー |
キョウチク
|
| 提出日時 | 2022-05-16 15:13:07 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 604 ms / 2,000 ms |
| コード長 | 697 bytes |
| コンパイル時間 | 3,412 ms |
| コンパイル使用メモリ | 80,752 KB |
| 実行使用メモリ | 64,128 KB |
| 最終ジャッジ日時 | 2024-09-14 07:15:53 |
| 合計ジャッジ時間 | 14,155 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
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();
}
}
キョウチク