Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) A,B,C
A.题目链接:http://codeforces.com/contest/828/problem/A
解题思路:
直接暴力模拟
#include<bits/stdc++.h>
using namespace std; int main()
{
int m,d,s,i,num=,ans=,a[];
cin>>m>>d>>s;
for(i=;i<m;i++){
cin>>a[i];
if(a[i]==&&d)
d--;
else if(a[i]==&&d==&&s){
s--;num++;
}
else if(a[i]==&&s){
s--;
}
else if(a[i]==&&s==)
ans+=;
else if(a[i]==&&s==&&d==&&num)
num--;
else if(a[i]==&&s==&&d==&&num==)
ans++;
}
cout<<ans<<endl;
}
B.题目链接:http://codeforces.com/contest/828/problem/B
思路:
暴力
#include<bits/stdc++.h>
using namespace std;
#define inf 2e9
int main()
{
char mp[][];
int m,n,i,j,num=,ans=;
cin>>m>>n;
for(i=;i<=m;i++){
for(j=;j<=n;j++){
cin>>mp[i][j];
}
}
int maxi = -inf,maxj = -inf;
int mini = inf,minj=inf;
for(i=;i<=m;i++){
for(j=;j<=n;j++){
if(mp[i][j]=='B'){
if(i>maxi)
maxi = i;
if(i<mini)
mini = i;
if(j>maxj)
maxj = j;
if(j<minj)
minj = j;
num+=;
}
}
}
if(num==){
cout<<""<<endl;
return ;}
//cout<<num<<endl;
ans = max((maxi-mini+),(maxj - minj+));
//cout<<ans<<endl;
if(ans>m||ans>n)
cout<<"-1"<<endl;
else{
cout<<ans*ans-num<<endl;
}
return ;
}
C.题目链接:http://codeforces.com/contest/828/problem/C
解题思路:
暴力会超时,he前一区域比较,如果没有重合的进行替换操作,重合跳过;
#include<bits/stdc++.h>
using namespace std;
char s[];
int main()
{
int m,n,i,j,k,pre,x,maxx = -;
string s1;
ios::sync_with_stdio(false);
cin.tie();
cin>>m;
memset(s,'a',sizeof(s));
while(m--){
cin>>s1>>n;
int len = s1.size();
pre = -len;
for(i=;i<n;i++){
cin>>x;
for(k=max(,len-(x-pre));k<len;++k){
s[x+k-] = s1[k];
pre = x;
}
maxx = max(maxx,x+len-);
}
}
for(i=;i<maxx;i++)
cout<<s[i];
cout<<endl;
return ;
}
Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) A,B,C的更多相关文章
- Codeforces Round #423 (Div. 1, rated, based on VK Cup Finals)
Codeforces Round #423 (Div. 1, rated, based on VK Cup Finals) A.String Reconstruction B. High Load C ...
- Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) E. DNA Evolution 树状数组
E. DNA Evolution 题目连接: http://codeforces.com/contest/828/problem/E Description Everyone knows that D ...
- Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) Problem E (Codeforces 828E) - 分块
Everyone knows that DNA strands consist of nucleotides. There are four types of nucleotides: "A ...
- Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) D. High Load 构造
D. High Load 题目连接: http://codeforces.com/contest/828/problem/D Description Arkady needs your help ag ...
- Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) C. String Reconstruction 并查集
C. String Reconstruction 题目连接: http://codeforces.com/contest/828/problem/C Description Ivan had stri ...
- Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) Problem D (Codeforces 828D) - 贪心
Arkady needs your help again! This time he decided to build his own high-speed Internet exchange poi ...
- Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) Problem C (Codeforces 828C) - 链表 - 并查集
Ivan had string s consisting of small English letters. However, his friend Julia decided to make fun ...
- Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) Problem A - B
Pronlem A In a small restaurant there are a tables for one person and b tables for two persons. It i ...
- Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals)
题目链接:http://codeforces.com/contest/828 A. Restaurant Tables time limit per test 1 second memory limi ...
随机推荐
- UOJ400/LOJ2553 CTSC2018 暴力写挂 边分治、虚树
传送门--UOJ 传送门--LOJ 跟隔壁通道是一个类型的 要求的式子中有两个LCA,不是很方便,因为事实上在这种题目中LCA一般都是枚举的对象-- 第二棵树上的LCA显然是动不了的,因为没有其他的量 ...
- 【转】Influxdb 编译
编译针对当前 github上influxdb的master代码 其实github上的CONTRIBUTING.md 里已经说的很明白,按其一步步来开即开,唯一遇到的问题可能就是下载依赖时被墙无法下载, ...
- [Spark][Hive]Hive的命令行客户端启动:
[Spark][Hive]Hive的命令行客户端启动: [training@localhost Desktop]$ chkconfig | grep hive hive-metastore 0:off ...
- bootstrapTable使用场景及方式
场景一:混合开发,适用jsp.php前端不足 纯html结构 <div> <table id="table" data-toggle="table&q ...
- 【下一代核心技术DevOps】:(二)Rancher的应用及优点简介
1.环境选择 安装Rancher环境,一定要在干净的linux主机上进行,避免出现因配置导致的莫名其妙的问题.服务器操作系统建议CentOS7.4(内核3.10以上)低于这个版本的系统 如7.3 7. ...
- Scrum与看板区别
看板:在制品(work-in-progress, WIP)必须被限制 WIP上限和拉动式生产 1. Scrum与看板简述 Scrum:组织拆分,工作拆分,开发时间拆分,优化发布计划,过程优化 看板 ...
- Spring RPC 入门学习(1)-HelloWorld入门
Spring搭建RPC环境 第一,下载所需要的jar包,下载地址:https://yunpan.cn/cPErQeANrSMyB (提取码:63e5),见下图: 第二,新建动态WebProject,把 ...
- javascript DOM操作中的insertAdjacentHTML方法
插入HTML内容与文本内容以前用的是innerHTML与innerText方法,今天看到insertAdjacentHTML和 insertAdjacentText两个API,特地学习一下: inse ...
- LINUX内核分析第八周学习总结——进程的切换和系统的一般执行过程
LINUX内核分析第八周学习总结——进程的切换和系统的一般执行过程 张忻(原创作品转载请注明出处) <Linux内核分析>MOOC课程http://mooc.study.163.com/c ...
- 面向对象课程 - T-shirt
拿到了一件谜一样的T-shirt 吓得我赶紧捏了下hbb