結果

問題 No.365 ジェンガソート
ユーザー kenji_shioyakenji_shioya
提出日時 2016-05-30 23:38:36
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 546 bytes
コンパイル時間 3,660 ms
コンパイル使用メモリ 75,136 KB
実行使用メモリ 71,680 KB
最終ジャッジ日時 2024-04-16 19:00:08
合計ジャッジ時間 39,455 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
54,116 KB
testcase_01 AC 133 ms
54,064 KB
testcase_02 AC 134 ms
53,896 KB
testcase_03 AC 136 ms
54,032 KB
testcase_04 AC 135 ms
54,020 KB
testcase_05 AC 132 ms
54,240 KB
testcase_06 AC 134 ms
54,016 KB
testcase_07 AC 133 ms
53,884 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 136 ms
54,152 KB
testcase_15 AC 143 ms
53,720 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 269 ms
58,316 KB
testcase_19 AC 1,204 ms
71,244 KB
testcase_20 AC 378 ms
59,160 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 TLE -
testcase_28 WA -
testcase_29 TLE -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 TLE -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 546 ms
61,124 KB
testcase_37 TLE -
testcase_38 TLE -
testcase_39 AC 1,495 ms
71,680 KB
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

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;

    for (int n = 1; n < array.size(); n++){
      if (array.get(n - 1) > array.get(n)){
        count++;
        int x = array.get(n);
        array.remove(n);
        array.add(0, x);
      }
    }
    System.out.println(count);
  }
}
0