結果

問題 No.22 括弧の対応
ユーザー 🍮かんプリン
提出日時 2019-04-24 17:33:23
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 247 bytes
コンパイル時間 726 ms
コンパイル使用メモリ 54,752 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-08 05:33:03
合計ジャッジ時間 1,164 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

int main() {
    int N, K, cnt = 0;
    string S;
    cin >> N >> K >> S;
    char c = S[--K];
    while (cnt >= 0) cnt += S[++K] == c ? 1 : -1;
    cout << K + 1 << endl;
    return 0;
}
0