結果

問題 No.564 背の順
ユーザー tsunabittsunabit
提出日時 2018-07-08 18:45:15
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 714 bytes
コンパイル時間 4,132 ms
コンパイル使用メモリ 83,292 KB
実行使用メモリ 56,004 KB
最終ジャッジ日時 2023-09-22 07:36:27
合計ジャッジ時間 6,909 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
55,920 KB
testcase_01 AC 132 ms
55,328 KB
testcase_02 AC 159 ms
55,796 KB
testcase_03 WA -
testcase_04 AC 153 ms
55,668 KB
testcase_05 AC 162 ms
55,728 KB
testcase_06 AC 142 ms
55,784 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 131 ms
55,632 KB
testcase_10 AC 147 ms
53,672 KB
testcase_11 AC 133 ms
55,876 KB
権限があれば一括ダウンロードができます

ソースコード

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