結果
| 問題 |
No.564 背の順
|
| コンテスト | |
| ユーザー |
cande398
|
| 提出日時 | 2017-10-07 01:50:49 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 134 ms / 2,000 ms |
| コード長 | 634 bytes |
| コンパイル時間 | 2,031 ms |
| コンパイル使用メモリ | 74,404 KB |
| 実行使用メモリ | 41,552 KB |
| 最終ジャッジ日時 | 2024-11-17 03:16:01 |
| 合計ジャッジ時間 | 4,134 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 i, num = 0;
int Nama = sc.nextInt();
num = sc.nextInt();
int[] height = new int[num];
String[] str = {"st", "nd", "rd", "th"};
height[0] = Nama;
for(i=1;i<num;i++){
height[i] = sc.nextInt();
}
Arrays.sort(height);
for(i=0;i<num;i++){
if(height[i] == Nama){
System.out.print(num-i);
if((num-i)%10>0 && (num-i)%10<4){
System.out.println(str[((num-i)%10)-1]);
}
else System.out.println(str[3]);
}
}
}
}
cande398