結果

問題 No.564 背の順
コンテスト
ユーザー Haijinn
提出日時 2018-02-02 18:15:03
言語 C90(gcc15)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 649 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 176 ms
コンパイル使用メモリ 39,448 KB
最終ジャッジ日時 2026-02-24 00:53:19
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
#include <string.h>
int main(void)
{
	int h,n;
	int h2[102];
	int c=1;
	int i;
	int temp;
	int j;
	char s[1000];
	scanf("%d%d",&h,&n);
	for(i=0;i<n-1;i++){
		
		scanf("%d",&h2[i]);
		
	}
	for(i=0;i<n-1;i++){
		for(j=n-2;j>i;j--){
			if(h2[j]>h2[j-1]){
				temp=h2[j];
				h2[j]=h2[j-1];
				h2[j-1]=temp;
			}
		}
	}
	for(i=0;i<n-1;i++){
		if(h2[i]>h){
			
			
			c++;
			
			
		}
		
		
		
		
		
		
		
		
	}
	sprintf(s,"%d",c);
	if(s[strlen(s)-1]=='3'){
	printf("%srd\n",s);
	}else if(s[strlen(s)-1]=='2'){
	
	printf("%snd\n",s);
	
}else if(s[strlen(s)-1]=='1'){
	printf("%sst\n",s);
	
}else{
	
	printf("%sth\n",s);
}
	return 0;
}
0