結果

問題 No.965 門松列が嫌い
ユーザー あるふぁあるふぁ
提出日時 2020-01-13 20:34:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 743 bytes
コンパイル時間 738 ms
コンパイル使用メモリ 95,448 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-23 13:04:49
合計ジャッジ時間 1,387 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:39:13: 警告: ‘res’ may be used uninitialized [-Wmaybe-uninitialized]
   39 |     cout << res << endl;
      |             ^~~
main.cpp:26:9: 備考: ‘res’ はここで定義されています
   26 |     int res;
      |         ^~~

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <unordered_map>
#include <map>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using lint = long long;
using namespace std;

const int MOD = 1000000007;

int main() {
    int A, B, C;
    cin >> A >> B >> C;

    int m = max(A, B);
    m = max(m, C);
    int mi = min(A, B);
    mi = min(mi, C);

    int res;

    if (B == m) {
        res = min(abs(B - A), abs(B - C));
        res = min(res, abs(B-C));
    }
    else {
        if (B == mi) {
            res = min(abs(B-A), abs(B-C));
            res = min(res, abs(A-C));
        }
    }

    cout << res << endl;
    return 0;
}
0