結果

問題 No.504 ゲーム大会(ランキング)
ユーザー kazapyon27kazapyon27
提出日時 2017-06-07 01:12:50
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 812 bytes
コンパイル時間 4,713 ms
コンパイル使用メモリ 76,224 KB
実行使用メモリ 79,876 KB
最終ジャッジ日時 2023-10-23 18:02:15
合計ジャッジ時間 8,003 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
57,916 KB
testcase_01 AC 51 ms
52,440 KB
testcase_02 AC 53 ms
53,540 KB
testcase_03 AC 51 ms
51,524 KB
testcase_04 AC 51 ms
52,400 KB
testcase_05 AC 52 ms
53,524 KB
testcase_06 AC 51 ms
53,544 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

/*No.504 ゲーム大会(ランキング)*/
import java.io.*;
import java.util.*;
public class No504{
	public static void main(String[] args) {
		try(BufferedReader input =new BufferedReader(new InputStreamReader(System.in))){
			int player=Integer.parseInt(input.readLine());
			Integer score[] = new Integer [player];
			int K_score=Integer.parseInt(input.readLine());
			int Rank=0;
			for(int i=0;i<player;i++){
				if(i==0){
					score[i]=K_score;
				}else{
					score[i]=Integer.parseInt(input.readLine());
				}
			}
			for(int j=0;j<player;j++){
				Arrays.sort(score,0,j+1,Collections.reverseOrder());
				for(int k=Rank;k<player;k++){
					if(K_score==score[k]){
						Rank=k;
						break;						
					}
				}
				System.out.println(Rank+1);
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
0