結果

問題 No.570 3人兄弟(その1)
ユーザー Maeda
提出日時 2025-03-10 17:42:07
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 626 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 25,344 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-10 17:42:08
合計ジャッジ時間 699 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |                 scanf("%d",&brotherHeight[i]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>


void main(void){
	int brotherHeight[3] = {0,0,0};
	int orderList[3] = {1,2,3};

	for(int i = 0 ; i < 3;i++){
		scanf("%d",&brotherHeight[i]);
	}
	for(int i = 0 ; i < 3;i++){
		for(int j = i ; j < 3 ; j++){
			if(brotherHeight[i] > brotherHeight[j]){
				int num = brotherHeight[i];
				brotherHeight[i] = brotherHeight[j];
				brotherHeight[j] = num;
				
				num = orderList[i];
				orderList[i] = orderList[j];
				orderList[j] = num;
			}
		}
	}
	for(int i = 0 ; i < 3;i++){
		if(orderList[i] == 1){
			printf("A\n");
		}else if(orderList[i] == 2){
			printf("B\n");
		}else{
			printf("C\n");
		}
	}
}
0