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 ...
随机推荐
- Android 发送自定义广播(标准和本地)
1.首先自定义一个广播接收器:MyBroadcastReceiver package example.com.mybroadcastreceiver; import android.content.B ...
- 请问在EXECUTE IMMEDIATE中如何使用带有引号
转自:http://bbs.csdn.net/topics/300191423 从第一引号向后,如果遇到第二个引号,则看这个引号后面时候有紧挨着的引号,如果有则第二个引号被转义,即该保留该引号后面紧跟 ...
- Hive-1.2.1_03_DDL操作
Hive官方文档:Home-UserDocumentation Hive DDL官方文档:LanguageManual DDL 参考文章:Hive 用户指南 注意:各个语句的版本时间,有的是在 hiv ...
- kafka的Java客户端示例代码(kafka_2.11-0.8.2.2)
1.使用Producer API发送消息到Kafka 从版本0.9开始被KafkaProducer替代. HelloWorldProducer.java package cn.ljh.kafka.ka ...
- 【Nginx】什么是Nginx?为什么使用Nginx?
转文章 一.前言 为毛要用nginx服务器代理,不直接用tomcat 7.0,还做多了一次接请求? 这个是我想问的,公司的新项目是要用Nginx+tomcat7+jdk开发的,用户命名可以直接访问to ...
- Note 387206.1 ORA-15041: ASM diskgroup with unlike disks sizes
Applies to: Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 10.2.0.1 - Release: 10.1 to 10 ...
- sum-root-to-leaf-numbers (前序遍历)
class Solution { public: int sumNumbers(TreeNode *root) { ; if (root == NULL) return sum; return pre ...
- 把myeclipse的自动验证和自动构建都关掉
关闭自动构建: project - -build automatically 的勾去掉,如下图: 关闭自动验证:window - preferences-- myeclipse -- valida ...
- day06数据类型----元组、字典、集合
一.元组(tuple): python中将一些不能修改的值称为不可变的,而不可变的列表则被称之为元组. 注意元组一旦被定义则不可修改,因此一般我们不定义空元组. 元组是有序的,可存放多个数据| ...
- MP实战系列(七)之集成springboot
springboot是现在比较流行的微服使用的框架,springboot本质上就是将spring+springmvc+mybatis零配置化,基本上springboot的默认配置符合我们的开发.当然有 ...