結果
問題 | No.571 3人兄弟(その2) |
ユーザー |
![]() |
提出日時 | 2019-02-24 12:42:11 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 763 bytes |
コンパイル時間 | 1,809 ms |
コンパイル使用メモリ | 160,604 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-21 13:59:59 |
合計ジャッジ時間 | 2,128 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
#include <bits/stdc++.h>using namespace std;struct brother{char n; // メンバー名.int h; // 身長.int w; // 体重.bool operator<(const brother& another) const { return (h > another.h)|| (h == another.h && w < another.w); }};int main() {// 1. 入力情報取得.brother b[3];for(int i = 0; i < 3; i++){int h, w;char n = 'A' + i;cin >> h >> w;b[i].n = n, b[i].h = h, b[i].w = w;}// 2. 下記条件で, sort.// ① 身長がより高いほうが優れている// ② 長が同じであれば体重が軽いほうが優れているsort(b, b + 3);// 3. 終了.for(int i = 0; i < 3; i++) cout << b[i].n << endl;return 0;}