#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就是(()),剩下的全都输出单个即可

京公网安备 11010502036488号