結果

問題 No.564 背の順
コンテスト
ユーザー Grenache
提出日時 2017-09-08 22:23:41
言語 Java
(openjdk 27 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 146 ms / 2,000 ms
+ 420µs
コード長 886 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,073 ms
コンパイル使用メモリ 96,384 KB
実行使用メモリ 48,536 KB
最終ジャッジ日時 2026-10-15 18:18:11
合計ジャッジ時間 6,185 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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