結果
| 問題 | No.564 背の順 | 
| コンテスト | |
| ユーザー |  Haijinn | 
| 提出日時 | 2018-02-02 18:15:03 | 
| 言語 | C90 (gcc 12.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 649 bytes | 
| コンパイル時間 | 193 ms | 
| コンパイル使用メモリ | 21,632 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-12-31 06:15:36 | 
| 合計ジャッジ時間 | 813 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:12:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d%d",&h,&n);
      |         ^~~~~~~~~~~~~~~~~~~
main.c:15:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |                 scanf("%d",&h2[i]);
      |                 ^~~~~~~~~~~~~~~~~~
            
            ソースコード
#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;
}
            
            
            
        