結果

問題 No.564 背の順
コンテスト
ユーザー sasa
提出日時 2025-03-14 16:34:16
言語 C++14
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 645 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 92 ms
コンパイル使用メモリ 39,424 KB
実行使用メモリ 5,760 KB
最終ジャッジ日時 2026-07-07 02:48:24
合計ジャッジ時間 1,246 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 1 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>

int main(){
	int height,val;
	scanf("%d%d",&height,&val);
	
	int student[val];
	for(int i = 0;i < val - 1;i ++){
		scanf("%d",&student[i]);
	}
	// ソート(降順)
	for(int i = 0;i < val - 1;i ++){
		for(int j = 0;j < val - 1;j ++){
			if(student[i] < student[j]){
				int tmp = student[i];
				student[i] = student[j];
				student[j] = tmp;
			}
		}
	}
	int rank = 0;
	for(int i = 0;i < val - 1;i ++){
		if(student[i] < height){
			rank = i + 1;  
		}
	}
	if(rank == 1){
		printf("%dst",rank);
	}else if(rank == 2){
		printf("%dnd",rank);
	}else if(rank == 3){
		printf("%drd",rank);
	}else{
		printf("%dth",rank);
	}
}
0