結果

問題 No.564 背の順
ユーザー GrenacheGrenache
提出日時 2017-09-08 22:23:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 886 bytes
コンパイル時間 4,171 ms
コンパイル使用メモリ 78,040 KB
実行使用メモリ 41,732 KB
最終ジャッジ日時 2024-04-25 02:28:38
合計ジャッジ時間 6,817 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
41,452 KB
testcase_01 AC 122 ms
40,504 KB
testcase_02 AC 146 ms
41,148 KB
testcase_03 AC 140 ms
41,360 KB
testcase_04 AC 136 ms
41,600 KB
testcase_05 AC 146 ms
41,536 KB
testcase_06 AC 146 ms
41,512 KB
testcase_07 AC 138 ms
41,404 KB
testcase_08 AC 142 ms
41,732 KB
testcase_09 AC 137 ms
41,360 KB
testcase_10 AC 133 ms
41,284 KB
testcase_11 AC 137 ms
41,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder564 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int h = sc.nextInt();
		int n = sc.nextInt();

		int[] hh = new int[n - 1];
		int cnt = 1;
		for (int i = 0; i < n - 1; i++) {
			hh[i] = sc.nextInt();
			if (hh[i] > h) {
				cnt++;
			}
		}

		if (cnt % 10 == 1) {
			pr.printf("%dst\n", cnt);
		} else if (cnt % 10 == 2) {
			pr.printf("%dnd\n", cnt);
		} else if (cnt % 10 == 3) {
			pr.printf("%drd\n", cnt);
		} else {
			pr.printf("%dth\n", cnt);
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0