题解 | 小欧的括号嵌套

小欧的括号嵌套

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

#牛客春招刷题训练营#

全部评论

相关推荐

吴offer选手:我卡在笔试才是最好笑的,甚至没给我发过笔试链接
投递哔哩哔哩等公司6个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务