結果

問題 No.742 にゃんにゃんにゃん 猫の挨拶
ユーザー htensai
提出日時 2020-02-17 12:41:49
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 667 bytes
コンパイル時間 2,135 ms
コンパイル使用メモリ 74,248 KB
実行使用メモリ 53,328 KB
最終ジャッジ日時 2024-10-06 14:54:50
合計ジャッジ時間 5,289 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 12
権限があれば一括ダウンロードができます

ソースコード

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