結果

問題 No.742 にゃんにゃんにゃん 猫の挨拶
ユーザー htensaihtensai
提出日時 2020-02-17 12:44:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,190 ms / 2,500 ms
コード長 557 bytes
コンパイル時間 2,328 ms
コンパイル使用メモリ 74,156 KB
実行使用メモリ 41,484 KB
最終ジャッジ日時 2024-04-16 03:48:53
合計ジャッジ時間 5,152 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
36,740 KB
testcase_01 AC 53 ms
36,660 KB
testcase_02 AC 52 ms
36,952 KB
testcase_03 AC 52 ms
37,076 KB
testcase_04 AC 52 ms
36,896 KB
testcase_05 AC 56 ms
36,768 KB
testcase_06 AC 57 ms
36,500 KB
testcase_07 AC 90 ms
38,156 KB
testcase_08 AC 98 ms
38,432 KB
testcase_09 AC 53 ms
36,632 KB
testcase_10 AC 51 ms
36,932 KB
testcase_11 AC 1,190 ms
41,356 KB
testcase_12 AC 376 ms
41,484 KB
testcase_13 AC 53 ms
36,604 KB
testcase_14 AC 52 ms
36,620 KB
testcase_15 AC 53 ms
36,764 KB
権限があれば一括ダウンロードができます

ソースコード

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 = 0; i < n; i++) {
		    for (int j = i + 1; j < n; j++) {
		        if (arr[i] > arr[j]) {
		            count++;
		        }
		    }
		}
		System.out.println(count);
    }
}
0