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. python 对时间操作

    from datetime import datetime,timedelta 'date_test':fields.function(_datetime_all,type='datetime',  ...

  2. [Spark][Python]PageRank 程序

    PageRank 程序: file contents: page1 page3page2 page1page4 page1page3 page1page4 page2page3 page4 def c ...

  3. [python][spark]wholeTextFiles 读入多个文件的例子

    $pwd /home/training/mydir $cat file1.json {"firstName":"Fred", "lastName&qu ...

  4. Linux常用基础命令整理:关机命令、查看目录下文件命令等

    Linux常用基础命令整理:关机命令.查看目录下文件命令等 整理了一些Linux常用基础命令,欢迎指正. 首先记住四个热键,学会这四个键,收益一辈子. Tab按键---命令补齐功能Ctrl+c按键-- ...

  5. sql语句——行列互换

    SELECT 年份, SUM(case when 季度=1 then 销量 else 0 end) as 一季度, SUM(case when 季度=2 then 销量 else 0 end) as ...

  6. 基于vue2.0 +vuex+ element-ui后台管理系统:包括本地开发调试详细步骤

    效果演示地址, github地址: demo演示:         1.About 此项目是 vue2.0 + element-ui + node+mongodb 构建的后台管理系统,所有的数据都是从 ...

  7. 【nodejs】让nodejs像后端mvc框架(asp.net mvc)一样处理请求--目录(8/8 完结)

    为什么要做这个 在使用nodejs开发过程中,总是发现需要做很多重复性的体力劳动,且因为自身是服务端程序员出身,感觉有一些服务端好的东西其实可以在nodejs上得到应用并能提高一些开发工作效率. 本系 ...

  8. CSS文本实例

    CSS 文本属性可定义文本的外观. 通过文本属性,您可以改变文本的颜色.字符间距,对齐文本,装饰文本,对文本进行缩进,等等.#############################CSS 文本属性属 ...

  9. 12.13 Daily Scrum

    现在已经可以实现在应用中直接通过WebView浏览餐厅的网页,而不用再调用手机的浏览器. 收藏夹的功能也基本实现,接下来的目标时将收藏夹与每一个用户关联.   Today's Task Tomorro ...

  10. [2019BUAA软件工程]结对编程感想

    结对编程感想 写在前面   本博客为笔者在完成软件工程结对编程任务后对于编程过程.最终得分的一些感想与经验分享.此外笔者还对于本课程的结对编程部分提出了一些建议. Tips Link 作业要求博客 2 ...