結果

問題 No.564 背の順
ユーザー YOSHIYOSHI
提出日時 2021-03-20 11:19:37
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 893 bytes
コンパイル時間 4,010 ms
コンパイル使用メモリ 81,164 KB
実行使用メモリ 51,320 KB
最終ジャッジ日時 2024-04-30 22:09:00
合計ジャッジ時間 4,567 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
51,084 KB
testcase_01 AC 65 ms
51,004 KB
testcase_02 AC 62 ms
50,924 KB
testcase_03 AC 62 ms
50,808 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 82 ms
51,272 KB
testcase_07 AC 69 ms
51,224 KB
testcase_08 AC 71 ms
51,320 KB
testcase_09 AC 69 ms
51,148 KB
testcase_10 AC 63 ms
51,132 KB
testcase_11 AC 63 ms
50,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;

public class No00000564_Main {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args) throws IOException {
		String[] hn = br.readLine().split(" ");
		int h  = Integer.parseInt(hn[0]);
		int n = Integer.parseInt(hn[1]);
		Integer[] l = new Integer[n-1];
		for(int i = 0;i < n - 1; i++) {
			l[i] = Integer.parseInt(br.readLine());
		}
		Arrays.sort(l, Collections.reverseOrder());
		int r = n;
		for(int j = 0; j < n - 1; j++) {
			if(l[j] < h) {
				r = j + 1;
				break;
			}
		}
		if(r % 10 == 1) System.out.println(r + "st");
		if(r % 10 == 2) System.out.println(r + "nd");
		if(r % 10 == 3) System.out.println(r + "rd");
		if(r % 10 > 3) System.out.println(r + "th");
	}
}
0