結果

問題 No.632 穴埋め門松列
ユーザー ebicochinealebicochineal
提出日時 2018-01-19 21:46:31
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 570 bytes
コンパイル時間 1,465 ms
コンパイル使用メモリ 165,140 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 00:13:55
合計ジャッジ時間 1,799 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

bool f (int a, int b, int c) {
    return (c != a && ((b < a && b < c) || (b > a && b > c)));
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a[3];
    int p;
    string t;
    
    for (int i = 0; i < 3; ++i) {
        cin >> t;
        if (t == "?") {
            p = i;
        } else {
            a[i] = stoi(t);
        }
    }
    
    a[p] = 1;
    if (f(a[0], a[1], a[2])) { cout << 1; }
    a[p] = 4;
    if (f(a[0], a[1], a[2])) { cout << 4; }
    cout << endl;
    
    return 0;
}
0