結果
| 問題 |
No.570 3人兄弟(その1)
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-10 17:43:37 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 626 bytes |
| コンパイル時間 | 535 ms |
| コンパイル使用メモリ | 25,344 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-10 17:43:39 |
| 合計ジャッジ時間 | 1,258 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 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]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#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");
}
}
}
Maeda