結果
問題 | No.22 括弧の対応 |
ユーザー |
|
提出日時 | 2016-10-30 06:28:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 234 bytes |
コンパイル時間 | 1,715 ms |
コンパイル使用メモリ | 167,496 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 07:17:40 |
合計ジャッジ時間 | 2,028 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include<bits/stdc++.h> using namespace std;int main(){int n,k,a=0;string s;cin>>n>>k>>s;k--;if(s[k]=='('){do{if(s[k]=='(')a++;else a--;k++;}while(a);k--;}else{do{if(s[k]=='(')a++;else a--;k--;}while(a);k++;}cout<<k+1<<endl;return 0;}