| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 117020 | 陈家宝 | 表达式括号匹配1 | C++ | Accepted | 100 | 0 MS | 264 KB | 560 | 2023-12-21 13:53:27 |
#include<bits/stdc++.h> using namespace std; string s; int m; char stc[100001]; int main(){ cin>>s; for(int i=0;i<s.size();i++){ if(s[i]=='('||s[i]=='['){ m++; stc[m]=s[i]; } else{ if(s[i]==']'){ if(stc[m]!='['){ cout<<"Wrong"<<endl; return 0; } else{ stc[m]=0; m--; } } if(s[i]==')'){ if(stc[m]!='('){ cout<<"Wrong"<<endl; return 0; } else{ stc[m]=0; m--; } } } } if(m==0)cout<<"OK"; else cout<<"Wrong"; return 0; }