結果
問題 |
No.564 背の順
|
ユーザー |
![]() |
提出日時 | 2017-09-09 02:04:35 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 158 ms / 2,000 ms |
コード長 | 673 bytes |
コンパイル時間 | 2,589 ms |
コンパイル使用メモリ | 76,048 KB |
実行使用メモリ | 41,964 KB |
最終ジャッジ日時 | 2024-11-07 12:43:04 |
合計ジャッジ時間 | 5,064 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int N = sc.nextInt(); int rank = 1; for (int i = 0; i < N - 1; i++) { if (sc.nextInt() > H) { rank++; } } if (rank % 10 == 1) { System.out.println(rank + "st"); } else if (rank % 10 == 2) { System.out.println(rank + "nd"); } else if(rank % 10 == 3) { System.out.println(rank + "rd"); } else { System.out.println(rank + "th"); } } }