Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)-C-Bracket Subsequence
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char s[];
int main(){
int k,n;
int zk;
int yk;
while(~scanf("%d%d",&n,&k)){
zk=;
yk=;
scanf("%s",s);
int lens=strlen(s);
for (int i=;i<lens;i++){
if (s[i]=='(' && zk<k/){
zk++;
printf("(");
}else if (s[i]==')' && yk<k/){
yk++;
printf(")");
}
}
printf("\n");
}
return ;
}
Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)-C-Bracket Subsequence的更多相关文章
- E - Down or Right Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)
		
http://codeforces.com/contest/1023/problem/E 交互题 #include <cstdio> #include <cstdlib> #i ...
 - Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)-D- Array Restoration
		
我们知道不满足的肯定是两边大中间小的,这样就用RMQ查询两个相同等值的区间内部最小值即可,注意边界条件 #include<bits/stdc++.h> #define x first #d ...
 - Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)-A-Single Wildcard Pattern Matching
		
#include<iostream> #include<algorithm> #include<stdio.h> #include<string.h> ...
 - Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) E. Down or Right
		
从(1,1,n,n)每次只变一个坐标,进行询问. 如果问到对角线有距离限制, 再从(1,1,n/2,n/2)询问到(n/2,n/2,n,n) 记住前半部分贪心忘上走,后本部分贪心往右走 因为最后的路线 ...
 - Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)
		
考场上只做出了ABDE C都挂了... 题解: A 题解: 模拟 判断前面一段是否相同,后面一段是否相同,长度是否够(不能有重叠) Code: #include<stdio.h> #inc ...
 - D. Recovering BST Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)
		
http://codeforces.com/contest/1025/problem/D 树 dp 优化 f[x][y][0]=f[x][z][1] & f[z+1][y][0] ( gcd( ...
 - Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) -B C(GCD,最长连续交替序列)
		
B. Weakened Common Divisor time limit per test 1.5 seconds memory limit per test 256 megabytes input ...
 - Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)  B. Weakened Common Divis
		
题目链接 让你找一个数,使得这个数,可以被每个二元组的两个数中的一个数整除. 先将第一个二元组的两个数质因数分解一下,分解的质数加入set中,然后,对剩下的n-1个二元组进行遍历,每次遍历到的二元组对 ...
 - Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)
		
A : A. Doggo Recoloring time limit per test 1 second memory limit per test 256 megabytes input stand ...
 
随机推荐
- 如何使用C语言的面向对象
			
我们都知道,C++才是面向对象的语言,但是C语言是否能使用面向对象的功能? (1)继承性 typedef struct _parent { int data_parent; }Parent; type ...
 - 成功激活Win8.1专业版方法
			
前两天安装了Win8.1,感觉界面效果都很简约,速度很快,很喜欢,但是不是破解版,本想将就着用,等到真正破解工具出来了再激活,但是用了两天发现系统右下角屏幕上有未激活的提示,时常弹出激活设置,看着有点 ...
 - Linux 小知识翻译 - 「环境变量」
			
这次,谈谈关于「环境变量」的话题. 所谓变量,就是在程序中设置的,相当于在内存中准备的「一个用来存放数据的小箱子」. 即,程序通过变量来保存值,通过变量保存的内容来进行各式各样的计算处理. 「环境变量 ...
 - elasticsearch使用bulk实现批量操作
			
本篇文章提供ES原生批量操作语法及使用bulk批量操作文档.文章依旧提供语法,具体实现大家根据语法,在对应处进行替换即可 一.原生批量获取文档 1.获取指定文档值(1) 语法: GET /_mget ...
 - Python3编写网络爬虫09-数据存储方式二-JSON文件存储
			
2.JSON文件存储 全称为JavaScript Object Notation 通过对象和数组的组合来表示数据,构造简洁且结构化程度非常高.是一种轻量级的数据交换格式 2.1 对象和数组 在Java ...
 - pb中遍历查询数据库数据问题(数据库为 sql server)
			
指针可以实现但是不推荐 例如:(部分代码) for ll_a = 1 to ll_count ll_b = ll_i + ll_a //插入行行号先下移一位 dw_main.inser ...
 - bootstrap-datepicker default value
			
$('.selectDate').datepicker({ format : "yyyy/mm/dd", autoclose : true, startDate : new Dat ...
 - CF 633 E. Binary Table
			
题目链接 题目大意:给定一个棋盘,棋盘上有0或1,你可以将一整行取反或者一整列取反,要使得最后剩的1最少.\((1\le n\le 20,1\le m\le 100000)\). 一个容易想到的思路就 ...
 - kafka libjvm 报错
			
kafka集群 kafka-0 出现报错信息 # # A fatal error has been detected by the Java Runtime Environment: # # SIGS ...
 - Guide to Porting MetaMask to a New Environment
			
https://github.com/MetaMask/metamask-extension/blob/develop/docs/porting_to_new_environment.md MetaM ...