Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- int n;
- cin >> n;
- int i = 1;
- int cnt = 0;
- while(cnt < n){
- for(int j = 0; j < i && cnt < n; j++){
- cout << "(";
- cnt++;
- }
- for(int j = 0; j < i && cnt < n; j++){
- cout << ")";
- cnt++;
- }
- i++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement