题解 | 小欧的括号嵌套
小欧的括号嵌套
https://www.nowcoder.com/practice/0b461d2b82834cb1881567744effb0c1
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0);
typedef long long LL;
//const int N=;
int main()
{
IOS
int n, r;
cin>>n>>r;
for(int i=0; i<r; i++) cout<<"(";
for(int i=0; i<r; i++) cout<<")";
for(int i=0; i<n-r; i++) cout<<"()";
return 0;
}
括号嵌套,先把最大层数的输出,如2就是(()),剩下的全都输出单个即可
