結果

問題 No.564 背の順
ユーザー tsunabit
提出日時 2018-07-08 18:45:15
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 714 bytes
コンパイル時間 4,139 ms
コンパイル使用メモリ 79,580 KB
実行使用メモリ 54,456 KB
最終ジャッジ日時 2024-07-08 00:07:17
合計ジャッジ時間 6,220 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.stream.Stream;
import java.time.*;
import java.time.format.*;

public class No564 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int n = sc.nextInt();
		Integer[] hh = new Integer[n];
		for(int i = 0; i < n - 1; i++) {
			hh[i] = sc.nextInt();
		}
		hh[n - 1] = h;
		Arrays.sort(hh, Collections.reverseOrder());

		for(int i = 0; i < n; i++) {
			if(h == hh[i]) {
				if(i == 0) {
					System.out.println("1st");
				}else if(i == 1) {
					System.out.println("2nd");
				}else if(i == 2) {
					System.out.println("3rd");
				}else {
					System.out.println(i + 1 + "th");
				}
				return;
			}
		}

	}
}
0