結果

問題 No.564 背の順
ユーザー Mcpu3Mcpu3
提出日時 2018-06-21 23:51:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 619 bytes
コンパイル時間 1,901 ms
コンパイル使用メモリ 73,376 KB
実行使用メモリ 56,464 KB
最終ジャッジ日時 2023-09-13 07:44:49
合計ジャッジ時間 4,256 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,204 KB
testcase_01 AC 119 ms
56,000 KB
testcase_02 AC 128 ms
56,076 KB
testcase_03 AC 120 ms
56,188 KB
testcase_04 AC 119 ms
55,936 KB
testcase_05 AC 134 ms
56,428 KB
testcase_06 AC 129 ms
56,344 KB
testcase_07 AC 123 ms
55,888 KB
testcase_08 AC 130 ms
56,464 KB
testcase_09 AC 122 ms
56,192 KB
testcase_10 AC 120 ms
56,300 KB
testcase_11 AC 120 ms
55,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class no564{
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int i,j,h,n,k[]=new int[100],t;
		h=stdIn.nextInt();
		n=stdIn.nextInt();
		for(i=0;i<n-1;i++) k[i]=stdIn.nextInt();
		for(i=0;i<n-2;i++) {
			for(j=n-2;j>i;j--) {
				if(k[j-1]<k[j]) {
					t=k[j-1];
					k[j-1]=k[j];
					k[j]=t;
				}
			}
		}
		for(i=0;h<k[i]&&i<n-1;i++) ;
		h=i+1;
		System.out.print(h);
		if(h%10==1) System.out.print("st");
		else if(h%10==2) System.out.print("nd");
		else if(h%10==3) System.out.print("rd");
		else System.out.print("th");
	}
}
0