結果

問題 No.564 背の順
ユーザー GodNegotoGodNegoto
提出日時 2019-11-29 14:47:46
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 618 bytes
コンパイル時間 4,018 ms
コンパイル使用メモリ 86,736 KB
実行使用メモリ 54,772 KB
最終ジャッジ日時 2024-04-30 22:52:40
合計ジャッジ時間 6,513 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 159 ms
54,284 KB
testcase_01 AC 138 ms
54,188 KB
testcase_02 AC 166 ms
54,616 KB
testcase_03 WA -
testcase_04 AC 160 ms
54,192 KB
testcase_05 AC 171 ms
54,500 KB
testcase_06 AC 149 ms
54,408 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 138 ms
54,200 KB
testcase_10 AC 155 ms
54,012 KB
testcase_11 AC 141 ms
54,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package algo;

import java.util.*;

public class sample7 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<Integer> list = new ArrayList<Integer>();
		int H = sc.nextInt();
		list.add(H);
		int N = sc.nextInt();
		for(int i = 1; i < N; i++) {
			list.add(sc.nextInt());
		}
		Collections.sort(list);
		Collections.reverse(list);
		int r = list.indexOf(H) + 1;
		switch (r) {
		case 1:
			System.out.println("1st");
			break;
		case 2:
			System.out.println("2nd");
			break;
		case 3:
			System.out.println("3rd");
			break;
		default:
			System.out.println(r + "th");
		}
	}
}
0