結果

問題 No.564 背の順
ユーザー sasa
提出日時 2025-03-14 16:40:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 447 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 27,264 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-14 16:40:44
合計ジャッジ時間 1,380 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d%d",&height,&val);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~
main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 scanf("%d",&student);
      |                 ~~~~~^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	// 自身の身長・自身を含むクラスの人数・他人の身長
	int height,val,student;
	scanf("%d%d",&height,&val);
	
	int rank = 1;
	
	
	for(int i = 0;i < val - 1;i ++){
		scanf("%d",&student);
		if(student > height){
			rank++;
		}
	}
	
	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