結果

問題 No.564 背の順
ユーザー uafr_csuafr_cs
提出日時 2017-10-28 16:51:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 717 bytes
コンパイル時間 2,455 ms
コンパイル使用メモリ 82,544 KB
実行使用メモリ 41,948 KB
最終ジャッジ日時 2024-05-01 21:05:50
合計ジャッジ時間 5,115 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
41,556 KB
testcase_01 AC 154 ms
41,492 KB
testcase_02 AC 164 ms
41,784 KB
testcase_03 AC 151 ms
41,800 KB
testcase_04 AC 150 ms
41,332 KB
testcase_05 AC 158 ms
41,648 KB
testcase_06 AC 159 ms
41,900 KB
testcase_07 AC 152 ms
41,808 KB
testcase_08 AC 160 ms
41,948 KB
testcase_09 AC 149 ms
41,644 KB
testcase_10 AC 149 ms
41,812 KB
testcase_11 AC 152 ms
41,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	
	public static long MOD = 1000000007;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final long H = sc.nextLong();
		final int N = sc.nextInt();
		
		long[] lens = new long[N - 1];
		for(int i = 0; i < N - 1; i++){
			lens[i] = -sc.nextLong();
		}
		Arrays.sort(lens);
		
		int part = Arrays.binarySearch(lens, -H);
		assert(part < 0);
		
		part = (-(part + 1)) + 1;
		
		switch(part % 10){
		case 1: System.out.println(part + "st"); break;
		case 2: System.out.println(part + "nd"); break;
		case 3: System.out.println(part + "rd"); break;
		default: System.out.println(part + "th"); break;
		}
	
	}
}
0