結果

問題 No.742 にゃんにゃんにゃん 猫の挨拶
ユーザー htensaihtensai
提出日時 2020-02-17 12:41:49
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 667 bytes
コンパイル時間 2,367 ms
コンパイル使用メモリ 74,468 KB
実行使用メモリ 41,800 KB
最終ジャッジ日時 2024-04-16 03:48:47
合計ジャッジ時間 5,085 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 53 ms
37,044 KB
testcase_02 WA -
testcase_03 AC 54 ms
36,996 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 486 ms
41,352 KB
testcase_13 WA -
testcase_14 AC 56 ms
36,864 KB
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Main {
	public static void main (String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
		    arr[i] = Integer.parseInt(br.readLine());
		}
		int count = 0;
		for (int i = n - 1; i >= 0; i--) {
		    for (int j = 0; j < i; j++) {
		        if (arr[j] > arr[j + 1]) {
		            count++;
		            //int tmp = arr[j];
		            //arr[j] = arr[j + 1];
		            //arr[j + 1] = tmp;
		        }
		    }
		}
		System.out.println(count);
    }
}
0