結果

問題 No.365 ジェンガソート
ユーザー SagTokiSagToki
提出日時 2018-06-04 13:30:17
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,460 bytes
コンパイル時間 3,655 ms
コンパイル使用メモリ 81,072 KB
実行使用メモリ 71,084 KB
最終ジャッジ日時 2023-09-12 22:06:51
合計ジャッジ時間 11,287 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,348 KB
testcase_01 AC 123 ms
55,724 KB
testcase_02 AC 124 ms
55,572 KB
testcase_03 AC 123 ms
55,760 KB
testcase_04 AC 124 ms
55,268 KB
testcase_05 AC 124 ms
55,564 KB
testcase_06 AC 122 ms
55,712 KB
testcase_07 AC 123 ms
55,756 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 123 ms
55,744 KB
testcase_15 AC 133 ms
55,700 KB
testcase_16 WA -
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.ArrayList;
import java.util.InputMismatchException;

public class JengaSort {
    static Scanner scanner = new Scanner(System.in);
    public static void main(String[] args){
        int N = Input(1 , 100000);
        ArrayList<Integer> High = new ArrayList<>();
        for(int i = 0 ; i < N ; i++){
            High.add(Input(1,N));
        }
        int Result = Processing(N,High);
        System.out.println(Result);
    }
    
    public static int Input(int Min , int Max){
        int Number = scanner.nextInt();
        try{
            if(Number < Min || Number > Max){
                System.out.println(Min + "以上" + Max + "以下で入力してください");
                System.exit(0);
            }
        }catch(InputMismatchException e){
            System.out.println("数字を入力してください");
            System.exit(0);
        }catch(Exception E){
            System.out.println("予期せぬエラーです");
            System.exit(0);
        }
        return Number;
    }
    
    public static int Processing(int N , ArrayList<Integer> High){
        int Count = 0;
        for(int i = 0 ; i < N ; i++){
            for(int j = i + 1 ; j < High.size() ; j++){
                if(High.get(i) > High.get(j)){
                    Count++;
                    High.remove(j);
                    j--;
                }
            }
        }
        return Count;
    }
}
0