题目链接

A. Text Volume

题意:计算句子中,每个单词大写字母出现次数最多的那个的出现次数(混不混乱QAQ).

解题思路:注意getchar()就没啥了.

#include<cstdio>
#include<cstring>
#include<iostream>
#include<ctype.h>
#include<algorithm>
using namespace std;
int main()
{
int n;
char str[];
cin>>n;
getchar();
for(int i=;i<n;i++) scanf("%c",&str[i]);
int max_len=,cnt=;
for(int i=;i<n;i++)
{
if(isalpha(str[i])>)
{
if(str[i]>='A'&&str[i]<='Z') cnt++;
}
else max_len=max(max_len,cnt),cnt=;
}
max_len=max(max_len,cnt),cnt=;
cout<<max_len<<endl;
return ;
}

  B. Flag of Berland

题意:色光三原色,RGB,判断这三个字母是否都出现且围成的图案要完全一样(条纹).

解题思路:暴力模拟,扫扫扫,直接看代码吧.

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
char Map[][];
int n,m,x,y;
void solve(char ch)
{
int flag=;
x=y=;
for(int i=;i<n&&flag;i++)
{
for(int j=;j<m&&flag;j++)
{
if(Map[i][j]==ch)
{
flag=;
int ii=i+,jj=j+;
x++,y++;
while(Map[i][jj]==ch&&jj<m)
{
jj++; y++;
}
while(Map[ii][j]==ch&&ii<n)
{
ii++; x++;
}
for(int _i=i;_i<ii;_i++)
{
for(int _j=j;_j<jj;_j++)
if(Map[_i][_j]!=ch)
{
x=y=; return ;
}
}
}
}
}
}
int main()
{ cin>>n>>m;
for(int i=;i<n;i++) scanf("%s",Map[i]);
if( (n*m)%!= )
{
puts("NO"); return ;
}
int a=,b=,a1=,b1=,a2=,b2=;
solve('R');
a=x,b=y; solve('B');
a1=x,b1=y; solve('G');
a2=x,b2=y; if(a&&b&&a1&&b1&&a2&&b2&&a*b+a1*b1+a2*b2==n*m
&&a==a1&&a1==a2&&b==b1&&b1==b2)
puts("YES");
else puts("NO");
return ;
}

C. Two Seals

题意:在n*m纸上,盖两个印章,在不越界前提下要求总面积最大,印章可旋转着盖.

解题思路:双重for循环,直接暴力枚举,每次取一次max.

刚开始没注意到是盖两个,用背包写了半天,半路发现GG思密达...

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int x[],y[];
int main()
{
int n,a,b,sum=;
cin>>n>>a>>b;
if(a>b) swap(a,b);
for(int i=;i<=n;i++) cin>>x[i]>>y[i];
for(int i=;i<=n;i++)
for(int j=i+;j<=n;j++)
{
int sumx,sumy;
sumx=x[i]+x[j],sumy=max(y[i],y[j]);
if(sumx>sumy) swap(sumx,sumy);
if(sumx<=a&&sumy<=b) sum=max(sum,x[i]*y[i]+x[j]*y[j]); sumx=x[i]+y[j],sumy=max(y[i],x[j]);
if(sumx>sumy) swap(sumx,sumy);
if(sumx<=a&&sumy<=b) sum=max(sum,x[i]*y[i]+x[j]*y[j]); sumx=y[i]+x[j],sumy=max(x[i],y[j]);
if(sumx>sumy) swap(sumx,sumy);
if(sumx<=a&&sumy<=b) sum=max(sum,x[i]*y[i]+x[j]*y[j]); sumx=y[i]+y[j],sumy=max(x[i],x[j]);
if(sumx>sumy) swap(sumx,sumy);
if(sumx<=a&&sumy<=b) sum=max(sum,x[i]*y[i]+x[j]*y[j]);
}
cout<<sum<<endl;
return ;
}

Educational Codeforces Round 26 A B C题的更多相关文章

  1. Educational Codeforces Round 26

    Educational Codeforces Round 26 困到不行的场,等着中午显示器到了就可以美滋滋了 A. Text Volume time limit per test 1 second ...

  2. CodeForces 837F - Prefix Sums | Educational Codeforces Round 26

    按tutorial打的我血崩,死活挂第四组- - 思路来自FXXL /* CodeForces 837F - Prefix Sums [ 二分,组合数 ] | Educational Codeforc ...

  3. CodeForces - 837E - Vasya's Function | Educational Codeforces Round 26

    /* CodeForces - 837E - Vasya's Function [ 数论 ] | Educational Codeforces Round 26 题意: f(a, 0) = 0; f( ...

  4. CodeForces 837D - Round Subset | Educational Codeforces Round 26

    /* CodeForces 837D - Round Subset [ DP ] | Educational Codeforces Round 26 题意: 选k个数相乘让末尾0最多 分析: 第i个数 ...

  5. Educational Codeforces Round 26 [ D. Round Subset ] [ E. Vasya's Function ] [ F. Prefix Sums ]

    PROBLEM D - Round Subset 题 OvO http://codeforces.com/contest/837/problem/D 837D 解 DP, dp[i][j]代表已经选择 ...

  6. Educational Codeforces Round 26 F. Prefix Sums 二分,组合数

    题目链接:http://codeforces.com/contest/837/problem/F 题意:如题QAQ 解法:参考题解博客:http://www.cnblogs.com/FxxL/p/72 ...

  7. Educational Codeforces Round 26 B,C

    B. Flag of Berland 链接:http://codeforces.com/contest/837/problem/B 思路:题目要求判断三个字母是否是条纹型的,而且宽和高相同,那么先求出 ...

  8. Educational Codeforces Round 14 B. s-palindrome 水题

    B. s-palindrome 题目连接: http://www.codeforces.com/contest/691/problem/B Description Let's call a strin ...

  9. Educational Codeforces Round 26 D dp

    D. Round Subset time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

随机推荐

  1. 超星网站cc++

    a系统 苏龙杰     a系统 苏龙杰     目录 1 C/C ++程序设计 1.1 前 言 1.2 第一部分 基 础 篇 1.2.1 第1章 初识C 1.2.1.1 1.1 C语言的诞生与发展 1 ...

  2. DirectFB编程

    一.简介 DirectFB是一个轻量级的提供硬件图形加速,输入设备处理和抽象的图形库,它集成了支持半透明的视窗系统以及在LinuxFramebuffer驱动之上的多层显示.它是一个用软件封装当前硬件无 ...

  3. [Fiddler] 开启Fiddler抓包的时候产品报“证书错误”

    报错截图: 解决办法:同时开启产品和Fiddler,做如下处理:

  4. c++11多线程学习笔记之三 condition_variable使用

    从windows角度来说,condition_variable类似event. 阻塞等待出发,不过condition_variable可以批量出发. 代码如下: // 1111111.cpp : 定义 ...

  5. 2018.08.04 bzoj3261: 最大异或和(trie)

    传送门 简单可持久化01trie树. 实际上这东西跟可持久化线段树貌似是一个东西啊. 要维护题目给出的信息,就需要维护前缀异或和并且把它们插入一棵01trie树,然后利用贪心的思想在上面递归就行了,因 ...

  6. hdu-1175(bfs+剪枝)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1175 思路:用bfs,注意要转弯的次数,次数大于两次就跳过. #include<iostream ...

  7. 第四章 代词(Les pronoms )

    ★人称代词 .主语人称代词 第一人称和第二人称属纯人称代词,只能代人不能代物;第三人称可代人,亦可代物.如: La Terre est ronde. Elle tourne autour du Sol ...

  8. Navicat如何导出数据库的svg、pdf,png图片

    有时候各位可能有这么一种感觉,如果一个数据库中的表太多的话,查看起来不大方便,如果你习惯用navicat软件来查看er图的话,那也是更困难了,这里介绍一种方法,就是把这些关系结构导出一个可以用浏览器打 ...

  9. Object-C中 - self 和super 的含义

    //super:父类         //self:自己              //自己理解         //以MobilePhone为例,父类为NSObject         //在类方法 ...

  10. hdu 5882 Balanced Game 2016-09-21 21:22 80人阅读 评论(0) 收藏

    Balanced Game Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) To ...