A.题目链接:http://codeforces.com/contest/828/problem/A

解题思路:

直接暴力模拟

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int m,d,s,i,num=,ans=,a[];
  7. cin>>m>>d>>s;
  8. for(i=;i<m;i++){
  9. cin>>a[i];
  10. if(a[i]==&&d)
  11. d--;
  12. else if(a[i]==&&d==&&s){
  13. s--;num++;
  14. }
  15. else if(a[i]==&&s){
  16. s--;
  17. }
  18. else if(a[i]==&&s==)
  19. ans+=;
  20. else if(a[i]==&&s==&&d==&&num)
  21. num--;
  22. else if(a[i]==&&s==&&d==&&num==)
  23. ans++;
  24. }
  25. cout<<ans<<endl;
  26. }

B.题目链接:http://codeforces.com/contest/828/problem/B

思路:

暴力

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define inf 2e9
  4. int main()
  5. {
  6. char mp[][];
  7. int m,n,i,j,num=,ans=;
  8. cin>>m>>n;
  9. for(i=;i<=m;i++){
  10. for(j=;j<=n;j++){
  11. cin>>mp[i][j];
  12. }
  13. }
  14. int maxi = -inf,maxj = -inf;
  15. int mini = inf,minj=inf;
  16. for(i=;i<=m;i++){
  17. for(j=;j<=n;j++){
  18. if(mp[i][j]=='B'){
  19. if(i>maxi)
  20. maxi = i;
  21. if(i<mini)
  22. mini = i;
  23. if(j>maxj)
  24. maxj = j;
  25. if(j<minj)
  26. minj = j;
  27. num+=;
  28. }
  29. }
  30. }
  31. if(num==){
  32. cout<<""<<endl;
  33. return ;}
  34. //cout<<num<<endl;
  35. ans = max((maxi-mini+),(maxj - minj+));
  36. //cout<<ans<<endl;
  37. if(ans>m||ans>n)
  38. cout<<"-1"<<endl;
  39. else{
  40. cout<<ans*ans-num<<endl;
  41. }
  42. return ;
  43. }

C.题目链接:http://codeforces.com/contest/828/problem/C

解题思路:

暴力会超时,he前一区域比较,如果没有重合的进行替换操作,重合跳过;

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. char s[];
  4. int main()
  5. {
  6. int m,n,i,j,k,pre,x,maxx = -;
  7. string s1;
  8. ios::sync_with_stdio(false);
  9. cin.tie();
  10. cin>>m;
  11. memset(s,'a',sizeof(s));
  12. while(m--){
  13. cin>>s1>>n;
  14. int len = s1.size();
  15. pre = -len;
  16. for(i=;i<n;i++){
  17. cin>>x;
  18. for(k=max(,len-(x-pre));k<len;++k){
  19. s[x+k-] = s1[k];
  20. pre = x;
  21. }
  22. maxx = max(maxx,x+len-);
  23. }
  24. }
  25. for(i=;i<maxx;i++)
  26. cout<<s[i];
  27. cout<<endl;
  28. return ;
  29. }

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. C++模板的特化

    C++类模板的三种特化,讲得比较全面 By SmartPtr(http://www.cppblog.com/SmartPtr/) 针对一个模板参数的类模板特化的几种类型, 一是特化为绝对类型(全特化) ...

  2. odoo中的ORM操作

    ORM方法简介 OpenERP的关键组件, ORM是一个完整的对象关系映射层,是开发人员不必编写基本的SQL管道. 业务对象被声明继承字models.Models的python类. 这让业务对象在OR ...

  3. ASP.NET MVC和ASP.NET Core MVC中获取当前URL/Controller/Action (转载)

    ASP.NET MVC 一.获取URL(ASP.NET通用): [1]获取完整url(协议名+域名+虚拟目录名+文件名+参数) string url=Request.Url.ToString(); [ ...

  4. (原创)odoo关系字段在视图中的行为控制 总结

    字段类型 选项或属性 格式示例 描述 many2one , many2many_tags(widget) no_create options='{"no_create":True} ...

  5. WPF 模拟UI 键盘录入

    原文:WPF 模拟UI 键盘录入 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/yangyisen0713/article/details/1835 ...

  6. 浅谈CDQ分治与偏序问题

    初识CDQ分治 CDQ分治是一个好东西,一直听着dalao们说所以就去学了下. CDQ分治是我们处理各类问题的重要武器.它的优势在于可以顶替复杂的高级数据结构,而且常数比较小:缺点在于必须离线操作. ...

  7. tensorflow笔记:多层LSTM代码分析

    tensorflow笔记:多层LSTM代码分析 标签(空格分隔): tensorflow笔记 tensorflow笔记系列: (一) tensorflow笔记:流程,概念和简单代码注释 (二) ten ...

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

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

  9. Azure Load Balancer : 简介

    Azure 提供的负载均衡服务叫 Load Balancer,它工作在 ISO 七层模型的第四层,通过分析 IP 层及传输层(TCP/UDP)的流量实现基于 "IP + 端口" 的 ...

  10. 浅谈移动端设备标识码:DeviceID、IMEI、IDFA、UDID和UUID

    ---恢复内容开始--- 转:https://www.jianshu.com/p/38f4d1a4763b [心路历程] 最近刚好在思考工作中统计数据所用的标识码产生的数据误差到底有多大,借此机会几番 ...