結果
| 問題 |
No.564 背の順
|
| コンテスト | |
| ユーザー |
takeya_okino
|
| 提出日時 | 2017-09-18 22:36:35 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 673 bytes |
| コンパイル時間 | 2,517 ms |
| コンパイル使用メモリ | 76,732 KB |
| 実行使用メモリ | 56,364 KB |
| 最終ジャッジ日時 | 2024-11-08 02:37:50 |
| 合計ジャッジ時間 | 5,073 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 3 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int h = sc.nextInt();
int n = sc.nextInt();
int[] height = new int[n - 1];
for(int i = 0; i < n - 1; i++) {
height[i] = sc.nextInt();
}
Arrays.sort(height);
int ord = n;
for(int i = n - 2; i >= 0; i--) {
if(height[i] < h) {
ord = n - i - 1;
break;
}
}
String ans = "";
if(ord == 1) {
ans = "1st";
} else if(ord == 2) {
ans = "2nd";
} else if(ord == 3) {
ans = "3rd";
} else {
ans = ord + "th";
}
System.out.println(ans);
}
}
takeya_okino