結果

問題 No.564 背の順
ユーザー cande398
提出日時 2017-10-07 01:16:30
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 3,223 ms
コンパイル使用メモリ 84,916 KB
実行使用メモリ 41,656 KB
最終ジャッジ日時 2024-11-17 03:13:10
合計ジャッジ時間 4,838 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int i;
    int Nama = sc.nextInt();
    int num = sc.nextInt();
    int[] height = new int[num];
    String[] str = {"st", "nd", "rd", "th"};
    height[0] = Nama;
    for(i=1;i<num;i++){
      height[i] = sc.nextInt();
    }
    Arrays.sort(height);

    for(i=0;i<num;i++){
      if(height[i] == Nama)System.out.printf("%d%s\n", num-i, i>(num-4)?str[num-i-1]:str[3]);
    }
  }
}
0