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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. 最近找工作,有招JAVA开发的可以联系我,如果不嫌弃我2年前用C,也可以联系我

    java涉及到的技术工具:HSF.Pandora.Notify.Metaq.Diamond.Tddl.ScheduleX.精卫.Switch.BCP.Tair.Hbase.Mysql.Ads.Tlog ...

  2. LOJ2537 PKUWC2018 Minimax 树形DP、线段树合并

    传送门 题意:自己去看 首先可以知道,每一个点都有几率被选到,所以$i$与$V_i$的关系是确定了的. 所以我们只需要考虑每一个值的取到的概率. 很容易设计出一个$DP$:设$f_{i,j}$为在第$ ...

  3. UVA1265 Tour Belt Kruskal重构树、倍增、树上差分

    题目传送门 题意:定义$Tour \, Belt$为某张图上的一个满足以下条件的点集:①点集中至少有$2$个点②任意两点互相连通③图上两个端点都在这个点集中的边的权值的最小值严格大于图上只有一个端点在 ...

  4. EZ 2018 07 06 NOIP模拟赛

    又是慈溪那边给的题目,这次终于没有像上次那样尴尬了, T1拿到了较高的暴力分,T2没写炸,然后T3写了一个优雅的暴力就203pts,Rank3了. 听说其它学校的分数普遍100+,那我们学校还不是强到 ...

  5. Luogu P2657 [SCOI2009]windy数

    一道比较基础的数位DP,还是挺套路的. 首先看题,发现这个性质和数的大小无关,因此我们可以直接数位DP,经典起手式: \(f[a,b]=f(b)-f(a-1)\) 然后考虑如何求解\(f(x)\).我 ...

  6. Luogu P1341 无序字母对

    突然发现我现在很喜欢打图论题. 然而都是很easy的. 这道题很坑,用C++打了一遍莫名Too many or too few lines. 然后我打出了我的独门绝技Pascal.这可能是我最后一次用 ...

  7. Part 6:静态文件--Django从入门到精通系列教程

    该系列教程系个人原创,并完整发布在个人官网刘江的博客和教程 所有转载本文者,需在顶部显著位置注明原作者及www.liujiangblog.com官网地址. 前面我们编写了一个经过测试的投票应用,现在让 ...

  8. 如何使用chrome浏览器进行js调试找出元素绑定的点击事件

    大家有没有遇到这样的一个问题,我们在分析一些大型电子商务平台的Web前端脚本时,想找到一个元素绑定的点击事件,并不是那么容易,因为有些前端脚本封装的比较隐蔽,甚至有些加密脚本,用传统的查找元素ID.或 ...

  9. WEB 小案例 -- 网上书城(四)

    针对于这个小案例我们今天讲解结账操作,也是有关这个案例的最后一次博文,说实话这个案例的博文写的很糟糕,不知道该如何去表述自己的思路,所以内容有点水,其实说到底还是功力不够. 处理思路 点击结账,发送结 ...

  10. [UWP 自定义控件]了解模板化控件(4):TemplatePart

    1. TemplatePart TemplatePart(部件)是指ControlTemplate中的命名元素.控件逻辑预期这些部分存在于ControlTemplate中,并且使用protected ...