結果

問題 No.564 背の順
ユーザー cande398cande398
提出日時 2017-10-07 01:27:12
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 606 bytes
コンパイル時間 1,818 ms
コンパイル使用メモリ 80,920 KB
実行使用メモリ 41,796 KB
最終ジャッジ日時 2024-04-28 11:55:07
合計ジャッジ時間 3,896 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
41,160 KB
testcase_01 AC 120 ms
41,112 KB
testcase_02 AC 130 ms
41,116 KB
testcase_03 WA -
testcase_04 AC 110 ms
40,228 KB
testcase_05 AC 132 ms
41,520 KB
testcase_06 AC 131 ms
41,452 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 117 ms
41,444 KB
testcase_10 AC 118 ms
41,416 KB
testcase_11 AC 111 ms
39,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int i, num = 0;
    int Nama = sc.nextInt();
    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.print(num-i);
        if(i>num-4){
          System.out.println(str[num-i-1]);
        }
        else System.out.println(str[3]);
      }
    }
  }
}
0