結果

問題 No.632 穴埋め門松列
ユーザー ebicochinealebicochineal
提出日時 2018-01-19 21:46:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 570 bytes
コンパイル時間 1,699 ms
コンパイル使用メモリ 166,188 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 12:29:21
合計ジャッジ時間 2,179 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:27:10: warning: 'p' may be used uninitialized [-Wmaybe-uninitialized]
   27 |     a[p] = 4;
      |     ~~~~~^~~
main.cpp:13:9: note: 'p' was declared here
   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