結果

問題 No.365 ジェンガソート
ユーザー kenji_shioyakenji_shioya
提出日時 2016-05-31 00:29:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 630 bytes
コンパイル時間 3,814 ms
コンパイル使用メモリ 75,324 KB
実行使用メモリ 60,524 KB
最終ジャッジ日時 2024-04-16 19:07:45
合計ジャッジ時間 29,827 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
41,172 KB
testcase_01 AC 135 ms
41,420 KB
testcase_02 AC 135 ms
41,168 KB
testcase_03 AC 134 ms
41,284 KB
testcase_04 AC 133 ms
41,452 KB
testcase_05 AC 134 ms
41,376 KB
testcase_06 AC 138 ms
41,164 KB
testcase_07 AC 140 ms
41,436 KB
testcase_08 AC 137 ms
41,192 KB
testcase_09 AC 137 ms
41,112 KB
testcase_10 AC 136 ms
41,504 KB
testcase_11 AC 138 ms
41,180 KB
testcase_12 AC 138 ms
41,124 KB
testcase_13 AC 144 ms
41,560 KB
testcase_14 AC 138 ms
41,232 KB
testcase_15 AC 144 ms
41,492 KB
testcase_16 AC 1,166 ms
60,096 KB
testcase_17 AC 1,096 ms
60,496 KB
testcase_18 AC 276 ms
47,136 KB
testcase_19 AC 799 ms
51,096 KB
testcase_20 AC 404 ms
48,576 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 660 ms
49,160 KB
testcase_24 AC 1,095 ms
59,648 KB
testcase_25 AC 394 ms
48,252 KB
testcase_26 WA -
testcase_27 AC 1,393 ms
60,324 KB
testcase_28 WA -
testcase_29 AC 1,341 ms
60,456 KB
testcase_30 AC 848 ms
49,864 KB
testcase_31 AC 480 ms
48,596 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 344 ms
47,808 KB
testcase_35 AC 1,132 ms
59,748 KB
testcase_36 AC 575 ms
50,564 KB
testcase_37 AC 1,362 ms
60,240 KB
testcase_38 AC 1,438 ms
60,524 KB
testcase_39 AC 921 ms
58,996 KB
testcase_40 AC 1,146 ms
60,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
  }
}
0