結果
問題 | No.564 背の順 |
ユーザー | FVRChan |
提出日時 | 2017-09-29 12:03:49 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 719 bytes |
コンパイル時間 | 3,226 ms |
コンパイル使用メモリ | 77,472 KB |
実行使用メモリ | 41,832 KB |
最終ジャッジ日時 | 2024-04-27 16:14:45 |
合計ジャッジ時間 | 5,121 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 114 ms
41,228 KB |
testcase_01 | AC | 116 ms
41,496 KB |
testcase_02 | AC | 125 ms
41,448 KB |
testcase_03 | WA | - |
testcase_04 | AC | 105 ms
39,948 KB |
testcase_05 | AC | 128 ms
41,584 KB |
testcase_06 | AC | 127 ms
41,600 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 112 ms
41,028 KB |
testcase_10 | AC | 113 ms
41,204 KB |
testcase_11 | AC | 113 ms
41,216 KB |
ソースコード
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); } }