結果
問題 |
No.570 3人兄弟(その1)
|
ユーザー |
![]() |
提出日時 | 2017-11-21 18:51:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 497 bytes |
コンパイル時間 | 120 ms |
コンパイル使用メモリ | 27,904 KB |
最終ジャッジ日時 | 2025-01-05 04:16:58 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:15:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d", &a[0].height); | ~~~~~^~~~~~~~~~~~~~~~~~~~ main.cpp:16:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d", &a[1].height); | ~~~~~^~~~~~~~~~~~~~~~~~~~ main.cpp:17:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d", &a[2].height); | ~~~~~^~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> class inf { public: int height; char name; }; int main(void) { inf a[3]; scanf("%d", &a[0].height); scanf("%d", &a[1].height); scanf("%d", &a[2].height); a[0].name = 'A'; a[1].name = 'B'; a[2].name = 'C'; for(int i=0; i<3; i++){ for(int j=i+1; j<3; j++){ if(a[i].height<a[j].height){ inf temp = a[j]; a[j] = a[i]; a[i] = temp; } } } for(int i=0;i<3;i++){ printf("%c\n", a[i].name); } return 0; }