結果

問題 No.564 背の順
ユーザー Hdz06052373Hdz06052373
提出日時 2017-09-10 00:45:30
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 769 bytes
コンパイル時間 2,050 ms
コンパイル使用メモリ 79,872 KB
実行使用メモリ 41,824 KB
最終ジャッジ日時 2024-04-25 00:56:14
合計ジャッジ時間 4,191 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
41,208 KB
testcase_01 AC 125 ms
41,544 KB
testcase_02 AC 136 ms
41,384 KB
testcase_03 WA -
testcase_04 AC 120 ms
41,248 KB
testcase_05 AC 135 ms
41,496 KB
testcase_06 AC 133 ms
41,616 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 129 ms
41,424 KB
testcase_10 AC 110 ms
40,492 KB
testcase_11 AC 122 ms
41,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] h = new int[100];
		int n = 2; 
		int tmp;
		
		for(int i = 0; i < n; i++){
			h[i] = sc.nextInt();
			if(i == 0){
				n = sc.nextInt();
			}
		}
		int mr = h[0];
		for(int j = 0; j < n; j++){
			for(int k = j; k < n; k++){
				if(h[k] < h[j]){
					tmp = h[k];
					h[k] = h[j];
					h[j] = tmp;
				}
			}
		}
		int o = 0;
		for(int l = 0; l < n; l++){
			if(h[l] == mr){
				o = l;
				break;
			}
		}
		int num = n - o;
		if(num == 1){
			System.out.println(num + "st");
		}else if(num == 2){
			System.out.println(num + "nd");
		}else if(num == 3){
			System.out.println(num + "rd");
		}else{
			System.out.println(num + "th");
		}
	}
}
0