MCPcopy Create free account
hub / github.com/E869120/math-algorithm-book / main

Function main

codes/cpp/Code_5_10_4.cpp:8–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6string S;
7
8int main() {
9 // ����
10 cin >> N >> S;
11
12 // '(' �̐� - ')' �̐��� depth �Ƃ���
13 // �r���� depth �����ɂȂ����炱�̎��_�� No
14 for (int i = 0; i < N; i++) {
15 if (S[i] == '(') depth += 1;
16 if (S[i] == ')') depth -= 1;
17 if (depth < 0) {
18 cout << "No" << endl;
19 return 0;
20 }
21 }
22
23 // �Ō�Adepth = 0 ['(' �� ')' �̐�������] ���ǂ����ŏꍇ����
24 if (depth == 0) cout << "Yes" << endl;
25 else cout << "No" << endl;
26 return 0;
27}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected