結果

問題 No.495 (^^*) Easy
ユーザー f843nmfwisfeuwf843nmfwisfeuw
提出日時 2020-08-12 16:56:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 554 bytes
コンパイル時間 785 ms
コンパイル使用メモリ 92,296 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 00:46:26
合計ジャッジ時間 1,299 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:28:15: warning: 'L' may be used uninitialized [-Wmaybe-uninitialized]
   28 |             L += 1;
      |             ~~^~~~
main.cpp:22:9: note: 'L' was declared here
   22 |     int L, R;
      |         ^
main.cpp:30:15: warning: 'R' may be used uninitialized [-Wmaybe-uninitialized]
   30 |             R += 1;
      |             ~~^~~~
main.cpp:22:12: note: 'R' was declared here
   22 |     int L, R;
      |            ^

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>

using namespace std;


int main() {

    string S;
    cin >> S;

    int L, R;


    for (int i = 0; i < S.size(); ++i) {
        string subst = S.substr(i, 2);
        if (subst == "*)") {
            L += 1;
        } else if (subst == "(*") {
            R += 1;
        }
    }

    cout << L << " " << R << endl;

    return 0;
}
0