結果

問題 No.564 背の順
ユーザー aikon_marimoaikon_marimo
提出日時 2018-02-03 22:02:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 2,378 ms
コンパイル使用メモリ 73,652 KB
実行使用メモリ 56,172 KB
最終ジャッジ日時 2023-09-02 20:06:52
合計ジャッジ時間 5,069 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
55,836 KB
testcase_01 AC 137 ms
55,476 KB
testcase_02 AC 146 ms
55,648 KB
testcase_03 AC 139 ms
55,668 KB
testcase_04 AC 139 ms
55,472 KB
testcase_05 AC 148 ms
56,000 KB
testcase_06 AC 149 ms
56,172 KB
testcase_07 AC 141 ms
55,496 KB
testcase_08 AC 150 ms
55,660 KB
testcase_09 AC 140 ms
55,628 KB
testcase_10 AC 141 ms
55,544 KB
testcase_11 AC 140 ms
55,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int H = in.nextInt();
		int N = in.nextInt();
		int ans = 1;
		for (int i = 0; i < N-1; i++) {
			int hi = in.nextInt();
			if (H < hi) {
				ans++;
			}
		}
		if (ans%10 == 1) {
			System.out.println(ans + "st");
		} else if (ans%10 == 2) {
			System.out.println(ans + "nd");
		} else if (ans%10 == 3) {
			System.out.println(ans + "rd");
		} else {
			System.out.println(ans + "th");
		}
	}
}
0