結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  kenji_shioya | 
| 提出日時 | 2016-05-31 00:29:06 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 630 bytes | 
| コンパイル時間 | 3,796 ms | 
| コンパイル使用メモリ | 80,976 KB | 
| 実行使用メモリ | 73,504 KB | 
| 最終ジャッジ日時 | 2024-10-07 19:58:24 | 
| 合計ジャッジ時間 | 26,487 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 35 WA * 6 | 
ソースコード
import java.util.*;
public class Exercise38{
  public static void main (String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    ArrayList<Integer> array = new ArrayList<Integer>();
    for (int n = 0; n < num; n++){
      array.add(sc.nextInt());
    }
    int count = 0;
    int index = 1;
    while (index < array.size()){
      if (array.get(index) - array.get(index - 1) > 1){
        count++;
      }  
      if (array.get(index - 1) > array.get(index)){
        count++;
        array.remove(index);
        continue;
      }
      index++;
    }
    System.out.println(count);
  }
}
            
            
            
        