CodeForces 593A 2Char
暴力。
#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的更多相关文章
- CodeForces - 593A -2Char(思维+暴力枚举)
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is th ...
- CodeForces 593A
题目链接: http://codeforces.com/problemset/problem/593/A 题意: 给你n个字符串,字符串只包含小写字母,从中选取任意个字符串,拼成一封信,这封信中至多有 ...
- Codeforces Round #329(Div2)
CodeForces 593A 题意:n个字符串,选一些字符串,在这些字符串中使得不同字母最多有两个,求满足这个条件可选得的最多字母个数. 思路:用c[i][j]统计文章中只有i,j对应两个字母出现的 ...
- 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 ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
随机推荐
- 一段字符串中间提取json字符串
项目过程中经常打日志:LOG.error("[failure][CreateOrder] param:{}", JSON.toJSONString(userCreateOrderD ...
- Redis学习笔记(四)集合进阶
1.组合与关联多个集合 差集: SDIFF key1 [key2...](返回存在于key1但不存在其他集合中的元素) SDIFFSTORE destination key1 [key2...](将存 ...
- Elasticsearch搜索含有数字标签的处理
{"tag_id":“12345”} 在search的时候是完全匹配,因为Elasticsearch在处理这个的过程中把“123456”字符当成一个整体的数据,因此折腾了好久就是找 ...
- smile domain name www.bn-nd.com for sell. Please contact boyanzheng at foxmail.com 微笑的域名。请联系邮箱。
- Linux centos7开机界面出现多个选项
centos7开机界面出现多个选项时 前面几个选项正常启动,最后一个选项急救模式启动(系统出项问题不能正常启动时使用并修复系统) 在CentOS更新后,并不会自动删除旧内核.所以在启动选项中会有多个内 ...
- 递推(三):POJ中的三道递推例题POJ 1664、POJ 2247和POJ 1338
[例9]放苹果(POJ 1664) Description 把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法. In ...
- Java文件编译与反编译:javac命令和javap命令
1.创建一个Test.java文件,并输入内容 public class Test{ private int m; public int inc(){ return m + 1; } } 2.使用ja ...
- sqlserver差异备份3117
1.出现错误"3117" 2.完整备份/选项/不对数据库执行任何操作 3.数据库显示"正在还原" 4.差异备份/选项/回滚 5.数据库完整备份与差异备份成功
- ffmpeg mp4 mp3 wav flac webm aac ac3 ogg格式转换
版权声明:本文为博主原创文章,未经允许不得转载. ffmpeg是Linux中转换音频视频文件的常用工具. mp4 to mp3: ffmpeg -i $ID.mp4 -acodec libmp3lam ...
- qemu-img命令
qemu-img是QEMU的磁盘管理工具,在qemu-kvm源码编译后就会默认编译好qemu-img这个二进制文件.qemu-img也是QEMU/KVM使用过程中一个比较重要的工具,本节对其用法和实践 ...