結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
41,536 KB
testcase_01 AC 108 ms
41,040 KB
testcase_02 AC 124 ms
41,648 KB
testcase_03 WA -
testcase_04 AC 120 ms
41,728 KB
testcase_05 AC 123 ms
41,568 KB
testcase_06 AC 119 ms
41,712 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 108 ms
41,136 KB
testcase_10 AC 117 ms
41,336 KB
testcase_11 AC 115 ms
41,396 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