結果

問題 No.564 背の順
ユーザー cande398cande398
提出日時 2017-10-07 01:16:30
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 2,005 ms
コンパイル使用メモリ 84,200 KB
実行使用メモリ 54,460 KB
最終ジャッジ日時 2024-04-28 11:54:44
合計ジャッジ時間 4,070 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
52,968 KB
testcase_01 AC 107 ms
53,296 KB
testcase_02 AC 134 ms
54,016 KB
testcase_03 WA -
testcase_04 AC 108 ms
53,184 KB
testcase_05 AC 130 ms
54,020 KB
testcase_06 AC 127 ms
54,000 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 118 ms
53,860 KB
testcase_10 AC 113 ms
53,760 KB
testcase_11 AC 102 ms
53,148 KB
権限があれば一括ダウンロードができます

ソースコード

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