結果

問題 No.564 背の順
ユーザー OlderInvestor
提出日時 2017-09-19 18:02:10
言語 Java
(openjdk 23)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 728 bytes
コンパイル時間 4,188 ms
コンパイル使用メモリ 76,440 KB
実行使用メモリ 41,820 KB
最終ジャッジ日時 2024-11-08 05:38:20
合計ジャッジ時間 6,145 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class No564 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int h = sc.nextInt();
        int n = sc.nextInt();
        int cnt = 1, other;
        for(int i = 0; i < n - 1; i++) {
            other = sc.nextInt();
            if(other > h) cnt++;
        }

        switch(cnt % 10) {
        case 1:
            System.out.println(cnt + "st");
            break;
        case 2:
            System.out.println(cnt + "nd");
            break;
        case 3:
            System.out.println(cnt + "rd");
            break;
        default:
            System.out.println(cnt + "th");
            break;
        }
    }
}
0