結果
| 問題 | No.564 背の順 |
| コンテスト | |
| ユーザー |
takeya_okino
|
| 提出日時 | 2017-09-18 22:38:30 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 64 ms / 2,000 ms |
| + 976µs | |
| コード長 | 709 bytes |
| 記録 | |
| コンパイル時間 | 1,421 ms |
| コンパイル使用メモリ | 88,276 KB |
| 実行使用メモリ | 45,892 KB |
| 最終ジャッジ日時 | 2026-09-21 01:14:39 |
| 合計ジャッジ時間 | 3,701 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
ソースコード
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 % 10) == 1) {
ans = ord + "st";
} else if((ord % 10) == 2) {
ans = ord + "nd";
} else if((ord % 10) == 3) {
ans = ord + "rd";
} else {
ans = ord + "th";
}
System.out.println(ans);
}
}
takeya_okino