結果
| 問題 | No.564 背の順 |
| コンテスト | |
| ユーザー |
matsuyoshi30
|
| 提出日時 | 2018-05-10 23:02:16 |
| 言語 | Java (openjdk 27.0.1.0.3 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 151 ms / 2,000 ms |
| + 532µs | |
| コード長 | 982 bytes |
| 記録 | |
| コンパイル時間 | 1,740 ms |
| コンパイル使用メモリ | 94,332 KB |
| 実行使用メモリ | 48,408 KB |
| 最終ジャッジ日時 | 2026-10-15 18:31:03 |
| 合計ジャッジ時間 | 5,046 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int nama = in.nextInt();
int n = in.nextInt();
int[] h = new int[n-1];
for(int i=0; i<n-1; i++)
h[i] = in.nextInt();
Arrays.sort(h);
int pos = n;
for(int i=n-2; i>=0; i--) {
if(nama < h[i]) {
continue;
} else if(i == n-2 && nama > h[i]) {
pos = 1;
break;
} else {
pos = n - i - 1;
break;
}
}
switch(pos%10) {
case 1:
System.out.println(pos + "st");
break;
case 2:
System.out.println(pos + "nd");
break;
case 3:
System.out.println(pos + "rd");
break;
default:
System.out.println(pos + "th");
break;
}
}
}
matsuyoshi30