暴力。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; struct X
{
char s[+];
int len;
int num;
int flag[];
}s[];
int n; int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
{
scanf("%s",s[i].s);
s[i].num=; s[i].len=strlen(s[i].s);
memset(s[i].flag,,sizeof s[i].flag);
for(int k=;s[i].s[k];k++)
{
if(s[i].flag[s[i].s[k]-'a']==)
{
s[i].flag[s[i].s[k]-'a']=;
s[i].num++;
}
}
} int ans=,tmp; for(int i=;i<;i++)
{
for(int j=i+;j<;j++)
{
tmp=;
for(int k=;k<=n;k++)
{
if(s[k].num==&&s[k].flag[i]==&&s[k].flag[j]==)
tmp=tmp+s[k].len;
else if(s[k].num==)
{
if(s[k].flag[i]==||s[k].flag[j]==) tmp=tmp+s[k].len;
}
}
ans=max(ans,tmp);
}
}
printf("%d\n",ans);
return ;
}

CodeForces 593A 2Char的更多相关文章

  1. CodeForces - 593A -2Char(思维+暴力枚举)

    Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is th ...

  2. CodeForces 593A

    题目链接: http://codeforces.com/problemset/problem/593/A 题意: 给你n个字符串,字符串只包含小写字母,从中选取任意个字符串,拼成一封信,这封信中至多有 ...

  3. Codeforces Round #329(Div2)

    CodeForces 593A 题意:n个字符串,选一些字符串,在这些字符串中使得不同字母最多有两个,求满足这个条件可选得的最多字母个数. 思路:用c[i][j]统计文章中只有i,j对应两个字母出现的 ...

  4. Codeforces Round #329 (Div. 2) A. 2Char 暴力

    A. 2Char Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/593/problem/A De ...

  5. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  6. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  7. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  8. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  9. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

随机推荐

  1. Linux系统结构与终端控制台

    Linux系统结构与终端控制台 作者:Vashon 时间:20150418 以下主要是对Linux系统终端控制台切换及基本操作的范例,其他的理论就不多说了,直接进入实践部分. Starting.... ...

  2. 接口自动化- 基于 Python

    准备工作 这部分其实在谷歌或者百度上搜索下就可以完成的,可是我就是想再啰嗦一遍,说不定有比我更懒的同学呢哈哈~ 第一步 Python的安装配置 打开官网: https://www.python.org ...

  3. ABAP和XML数据格式互相转换的两种方式

    ABAP和XML数据格式互相转换是广大开发人员经常遇到的需求.本文介绍两种方式. 1. ABAP提供了一个工具类cl_proxy_xml_transform,通过它的两个方法abap_to_xml_x ...

  4. vscode 打开新文件不替换旧文件

    设置 "workbench.editor.enablePreview": false

  5. while循环(break、continue)

    while循环 流程:判断条件是否为真,如果条件为真,执行代码块,然后再次判断条件是否为真,如果为真,执行代码块,直到条件判断为假,结束循环 格式 while  条件: 代码块(循环体) else:- ...

  6. zabbix4.2学习笔记系列

    写在前面:对zabbix的接触始于对监控的了解,网上比较多zabbix相关博客,比较多基于3系列甚至2系列,最新开发版zabbix4.2版本已经出来,本博客基于4.2版本学习,参考官网4.2版本和网上 ...

  7. Spring-01 注解实现IOC

    Spring框架四大原则 使用pojo进行轻量级和最小侵入式开发. 通过依赖注入和基于接口编程实现松耦合. 使用AOP和默认习惯进行声明式编程. 使用AOP和模板(template)减少模式化代码. ...

  8. In line copy and paste to system clipboard

    On the Wiki Wiki Activity Random page Videos Photos Chat Community portal To do    Contribute  Watch ...

  9. php 后端规范

    后端框架地址: git@gitee.com:xielisen/xcore.git 框架使用规范,内部沟通 Controller命名规范 1, 首字母大写,其余小写 2, 对应数据库名称. 不要下划线 ...

  10. 我的java web之路(JSP基本语法)

    1.JSP注释 1.1输出注释 语法格式  <!--comment [<%= expression %>] --> <body> This is my JSP pa ...