結果

問題 No.632 穴埋め門松列
ユーザー merom686merom686
提出日時 2018-01-19 21:24:39
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 518 bytes
コンパイル時間 1,056 ms
コンパイル使用メモリ 73,024 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 00:00:25
合計ジャッジ時間 1,007 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main() {
    char c[3];

    int j;
    for (int i = 0; i < 3; i++) {
        cin >> c[i];
        if (c[i] == '?') j = i;
    }

    string s;
    for (int i = 0; i < 2; i++) {
        char t = i == 0 ? '1' : '4';
        c[j] = t;
        if ((c[1] < c[0] && c[1] < c[2]) || (c[1] > c[0] && c[1] > c[2])) s += t;
    }

    cout << s << endl;

    return 0;
}
0