結果
| 問題 |
No.570 3人兄弟(その1)
|
| コンテスト | |
| ユーザー |
Elk
|
| 提出日時 | 2018-05-27 00:55:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 580 bytes |
| コンパイル時間 | 104 ms |
| コンパイル使用メモリ | 22,784 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 18:19:05 |
| 合計ジャッジ時間 | 546 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d%d%d", &brother[0], &brother[1], &brother[2]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:18:15: warning: ‘max_cnt’ may be used uninitialized in this function [-Wmaybe-uninitialized]
18 | }else if(max_cnt == 1){
| ^~
ソースコード
#include <stdio.h>
int main(){
int brother[3];
int i, j, max = 0, max_cnt;
scanf("%d%d%d", &brother[0], &brother[1], &brother[2]);
for(i = 0; i < 3; i++){
for(j = 0; j < 3; j++){
if(max <= brother[j]){
max = brother[j];
max_cnt = j;
}
}
if(max_cnt == 0){
printf("A\n");
}else if(max_cnt == 1){
printf("B\n");
}else if(max_cnt == 2){
printf("C\n");
}
brother[max_cnt] = 0;
max = 0;
}
return 0;
}
Elk