結果
問題 |
No.570 3人兄弟(その1)
|
ユーザー |
![]() |
提出日時 | 2025-03-17 09:56:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 473 bytes |
コンパイル時間 | 234 ms |
コンパイル使用メモリ | 27,648 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-17 09:56:36 |
合計ジャッジ時間 | 805 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d",&height[i]); | ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(){ int height[3] = {0,0,0}; char str[4] = {'A', 'B', 'C', '\0'}; for(int i = 0;i < 3;i ++){ scanf("%d",&height[i]); } // ソート(昇順) for(int i = 0;i < 3;i ++){ for(int j = 0;j < 3;j ++){ if(height[i] < height[j]){ int tmp = height[i]; height[i] = height[j]; height[j] = tmp; int stmp = str[i]; str[i] = str[j]; str[j] = stmp; } } } for(int i = 0;i < 3;i ++){ printf("%c\n",str[i]); } }