結果
| 問題 |
No.564 背の順
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-20 11:13:01 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 910 bytes |
| コンパイル時間 | 4,182 ms |
| コンパイル使用メモリ | 90,956 KB |
| 実行使用メモリ | 51,212 KB |
| 最終ジャッジ日時 | 2024-11-20 20:12:43 |
| 合計ジャッジ時間 | 5,330 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 3 |
ソースコード
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;
public class No00000564_Main {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) throws IOException {
String[] hn = br.readLine().split(" ");
int h = Integer.parseInt(hn[0]);
int n = Integer.parseInt(hn[1]);
Integer[] l = new Integer[n-1];
for(int i = 0;i < n - 1; i++) {
l[i] = Integer.parseInt(br.readLine());
}
Arrays.sort(l, Collections.reverseOrder());
for(int j = 0; j < n - 1; j++) {
if(l[j] < h) {
if(j == 0) System.out.println((j + 1) + "st");
if(j == 1) System.out.println((j + 1) + "nd");
if(j == 2) System.out.println((j + 1) + "rd");
if(j > 2) System.out.println((j + 1) + "th");
return;
}
}
System.out.println(n + "th");
}
}