結果
| 問題 |
No.571 3人兄弟(その2)
|
| コンテスト | |
| ユーザー |
conankun
|
| 提出日時 | 2017-10-13 23:31:24 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,405 bytes |
| コンパイル時間 | 459 ms |
| コンパイル使用メモリ | 56,496 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-17 11:49:04 |
| 合計ジャッジ時間 | 1,091 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 WA * 5 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
// int max2(int x, int y) {
// return x > y ? x : y;
// }
// int max3(int x, int y, int z) {
// x = max2(x, y);
// return max2(x, z);
// }
// int min2(int x, int y) {
// return x < y ? x : y;
// }
// int min3(int x, int y, int z) {
// x = min2(x, y);
// return min2(x, z);
// }
struct Brother {
int height;
int weight;
char name;
};
Brother betterBrother(Brother a, Brother b) {
if (a.height == b.height) {
return a.weight < b.weight ? a : b;
}
return a.height > b.height ? a : b;
}
Brother worseBrother(Brother a, Brother b) {
if (a.height == b.height) {
return a.weight > b.weight ? a : b;
}
return a.height < b.height ? a : b;
}
int main() {
Brother A = { 0, 0, 'A', };
Brother B = { 0, 0, 'B', };
Brother C = { 0, 0, 'C', };
cin >> A.height >> A.weight >> B.height >> B.weight >> C.height >> C.weight;
Brother best = betterBrother(A, B);
best = betterBrother(best, C);
Brother worst = worseBrother(A, B);
worst = worseBrother(worst, C);
Brother normal = worseBrother(A, B);
normal = betterBrother(normal, C);
cout << best.name << "\n";
cout << normal.name << "\n";
cout << worst.name << "\n";
int a;
cin >> a;
return 0;
}
conankun