結果
| 問題 | 
                            No.564 背の順
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Maeda
                         | 
                    
| 提出日時 | 2025-03-10 16:17:30 | 
| 言語 | C  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 696 bytes | 
| コンパイル時間 | 387 ms | 
| コンパイル使用メモリ | 25,600 KB | 
| 実行使用メモリ | 7,328 KB | 
| 最終ジャッジ日時 | 2025-03-10 16:17:33 | 
| 合計ジャッジ時間 | 2,862 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 3 | 
| other | RE * 9 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d",&namaHeight);
      |         ^~~~~~~~~~~~~~~~~~~~~~~
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d",&count);
      |         ^~~~~~~~~~~~~~~~~~
main.c:10:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%d",&heightList[i]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
void main(void){
	int namaHeight = 0 ,count = 0;
	int heightList[count];
	scanf("%d",&namaHeight);
	scanf("%d",&count);
	heightList[0] = namaHeight;
	for(int i = 1;i < count;i++){
		scanf("%d",&heightList[i]);
	}
	for(int i = 0 ; i < count;i++){
		for(int j = i ; j < count;j++){
			if(heightList[i] < heightList[j]){
				int num = heightList[i];
				heightList[i] = heightList[j];
				heightList[j] = num;
			}
		}
	}
	for(int i = 0;i < count;i++){
		if(heightList[i] == namaHeight){
			printf("%d",i+1);
			if(i == 0){
				printf("st\n");
			}else if(i == 1){
				printf("nd\n");
			}else if(i == 2){
				printf("rd\n");
			}else{
				printf("th\n");
			}
			break;
		}
	}
}
            
            
            
        
            
Maeda