'commit'
This commit is contained in:
24
TangDou/XiTi/1390.cpp
Normal file
24
TangDou/XiTi/1390.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
//输入+输出重定向
|
||||
//freopen("../x.in", "r", stdin);
|
||||
//freopen("../x.out", "w", stdout);
|
||||
|
||||
string s;
|
||||
getline(cin, s);
|
||||
stack<char> st;
|
||||
for (int i = 0; i < s.size(); ++i) {
|
||||
if (s[i] == '(') st.push('(');
|
||||
if (s[i] == ')') st.pop();
|
||||
}
|
||||
|
||||
if (st.empty()) cout << "YES" << endl;
|
||||
else cout << "NO" << endl;
|
||||
//关闭文件
|
||||
//fclose(stdin);
|
||||
//fclose(stdout);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user