結果

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

ソースコード

diff #

#include <stdio.h>

int main(){
	int height,val;
	scanf("%d%d",&height,&val);
	
	int rank = 1;
	
	int student[val];
	for(int i = 0;i < val - 1;i ++){
		scanf("%d",&student[i]);
		if(student[i] > 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