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. android 之TCP客户端编程

    补充,由于这篇文章是自己入门的时候写的,随着Android系统的升级可能有发送需要在任务 中进行,如有问题请百度 thread 或者看下面链接的文章 https://www.cnblogs.com/y ...

  2. ASP.NET Core 中 HttpContext 详解与使用 | Microsoft.AspNetCore.Http 详解 (转载)

    “传导体” HttpContext 要理解 HttpContext 是干嘛的,首先,看图 图一 内网访问程序 图二 反向代理访问程序 ASP.NET Core 程序中,Kestrel 是一个基于 li ...

  3. 【转】单KEY业务,数据库水平切分架构实践

    本文将以“用户中心”为例,介绍“单KEY”类业务,随着数据量的逐步增大,数据库性能显著降低,数据库水平切分相关的架构实践: 如何来实施水平切分 水平切分后常见的问题 典型问题的优化思路及实践 一.用户 ...

  4. Luogu P3825 [NOI2017]游戏

    这道题看上去NPC啊,超级不可做的样子. 我们先分析一下简单的情形:没有\(x\)地图 此时每个地图由于限制掉一种汽车,那么显然只会有两种选择. 再考虑到限制的情况,那么大致做法就很显然了--2-SA ...

  5. (理论篇)从基础文件IO说起虚拟内存,内存文件映射,零拷贝

    为了快速构建项目,使用高性能框架是我的职责,但若不去深究底层的细节会让我失去对技术的热爱. 探究的过程是痛苦并激动的,痛苦在于完全理解甚至要十天半月甚至没有机会去应用,激动在于技术的相同性,新的框架不 ...

  6. Quartz.net 定时任务之储存与持久化和集群(源码)

    一.界面 1.这篇博客不上教程.直接看结果(包括把quartz任务转换成Windows服务) (1).主界面 (2).添加任务(默认执行) (3).编辑(默认开启) (4).关闭和开启 2.代码说明 ...

  7. Scrum Meeting NO.9

    Scrum Meeting No.9 1.会议内容 2.任务清单 徐越 序号 近期的任务 进行中 已完成 1 代码重构:前端通讯模块改为HttpClient+Json √ 2 "我" ...

  8. Linux内核设计与实现 第十七章

    1. 设备类型 linux中主要由3种类型的设备,分别是: 设备类型 代表设备 特点 访问方式 块设备 硬盘,光盘 随机访问设备中的内容 一般都是把设备挂载为文件系统后再访问 字符设备 键盘,打印机 ...

  9. Linux内核期末总结

    20135316王剑桥<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC 1000029000 第一周 http://www.cn ...

  10. java数值运算后精度丢失问题

    最近连续俩次遇到运算后数值精度丢失问题,所以记录一下. 问题1:java计算百分比,应该得到57,可返回的就是56 在java代码中 BigDecimal progress; BigDecimal a ...