結果
| 問題 | No.564 背の順 |
| コンテスト | |
| ユーザー |
FVRChan
|
| 提出日時 | 2017-09-29 12:03:49 |
| 言語 | Java (openjdk 25.0.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 719 bytes |
| 記録 | |
| コンパイル時間 | 2,400 ms |
| コンパイル使用メモリ | 77,540 KB |
| 実行使用メモリ | 41,724 KB |
| 最終ジャッジ日時 | 2024-11-15 19:48:32 |
| 合計ジャッジ時間 | 4,627 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 3 |
ソースコード
import java.util.Comparator;
import java.util.LinkedList;
import java.util.Scanner;
public class Main{
private static Scanner sc=new Scanner(System.in);
public static void main(String args[])throws Exception{
int height=sc.nextInt(),n=sc.nextInt();
LinkedList<Integer>queue=new LinkedList<Integer>();
queue.offer(height);
for(int i=0;i<n-1;i++)queue.offer(sc.nextInt());
queue.sort(Comparator.reverseOrder());
int counter=0;
for(int i=0;i<queue.size();i++){
if(queue.get(i)==height){
counter=i+1;
break;
}
}String s=String.valueOf(counter);
switch(counter){
case 1:s+="st";break;
case 2:s+="nd";break;
case 3:s+="rd";break;
default:s+="th";break;
}System.out.println(s);
}
}
FVRChan