結果

問題 No.564 背の順
ユーザー aikon_marimo
提出日時 2018-02-03 22:02:22
言語 Java
(openjdk 23)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 2,502 ms
コンパイル使用メモリ 76,456 KB
実行使用メモリ 42,112 KB
最終ジャッジ日時 2024-06-12 02:29:52
合計ジャッジ時間 5,340 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

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