結果

問題 No.365 ジェンガソート
ユーザー kenji_shioya
提出日時 2016-05-30 23:38:36
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 546 bytes
コンパイル時間 3,912 ms
コンパイル使用メモリ 76,404 KB
実行使用メモリ 71,776 KB
最終ジャッジ日時 2024-10-07 19:43:48
合計ジャッジ時間 40,714 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 WA * 21 TLE * 5
権限があれば一括ダウンロードができます

ソースコード

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