結果

問題 No.564 背の順
コンテスト
ユーザー misk703
提出日時 2018-06-04 14:44:37
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
WA  
実行時間 -
コード長 628 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,889 ms
コンパイル使用メモリ 84,812 KB
実行使用メモリ 47,132 KB
最終ジャッジ日時 2026-03-20 06:18:34
合計ジャッジ時間 4,032 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class No564 {

    public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	ArrayList<Integer> list = new ArrayList<>();
	int H = s.nextInt();
	int N = s.nextInt();
	list.add(H);
	for(int i=1;i<N;i++){
	    list.add(s.nextInt());
	}
	Collections.sort(list);
	Collections.reverse(list);
	int rank = list.indexOf(H) + 1;
	String out;
	if(rank == 1){
	    out = "st";
	}else if(rank == 2){
	    out = "nd";
	}else if(rank == 3){
	    out = "rd";
	}else{
	    out = "th";
	}
	System.out.println(rank + out);
     }

}
0