結果
問題 |
No.564 背の順
|
ユーザー |
|
提出日時 | 2018-07-08 18:53:49 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 132 ms / 2,000 ms |
コード長 | 739 bytes |
コンパイル時間 | 4,131 ms |
コンパイル使用メモリ | 79,744 KB |
実行使用メモリ | 42,108 KB |
最終ジャッジ日時 | 2024-07-08 00:31:58 |
合計ジャッジ時間 | 5,357 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
import java.util.*; import java.util.stream.Stream; import java.time.*; import java.time.format.*; public class No564 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int h = sc.nextInt(); int n = sc.nextInt(); Integer[] hh = new Integer[n]; hh[0] = h; for(int i = 1; i < n; i++) { hh[i] = sc.nextInt(); } Arrays.sort(hh, Collections.reverseOrder()); for(int i = 0; i < n; i++) { if(h == hh[i]) { int j = i + 1; if(j%10 == 1) { System.out.println(j + "st"); }else if(j%10 == 2) { System.out.println(j + "nd"); }else if(j%10 == 3) { System.out.println(j + "rd"); }else { System.out.println(j + "th"); } return; } } } }