結果
| 問題 | 
                            No.564 背の順
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-03-20 11:15:48 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 74 ms / 2,000 ms | 
| コード長 | 930 bytes | 
| コンパイル時間 | 3,504 ms | 
| コンパイル使用メモリ | 81,036 KB | 
| 実行使用メモリ | 43,876 KB | 
| 最終ジャッジ日時 | 2024-11-20 20:17:35 | 
| 合計ジャッジ時間 | 5,084 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
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());
		for(int j = 0; j < n - 1; j++) {
			if(l[j] < h) {
				if(j % 10 == 0) System.out.println((j + 1) + "st");
				if(j % 10 == 1) System.out.println((j + 1) + "nd");
				if(j % 10 == 2) System.out.println((j + 1) + "rd");
				if(j % 10 > 2) System.out.println((j + 1) + "th");
				return;
			}
		}
		System.out.println(n + "th");
	}
}