CodeForces 593A 2Char
2024-08-29 21:30:32
暴力。
#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 ;
}
最新文章
- PHP注册与登录【2】用户注册
- 黑马程序员_Java基础:IO流总结
- 如何恢复Mysql数据库
- linux运维中的命令梳理(二)
- [Asp.net]Uploadify所有配置说明,常见bug问题分析
- table中td的空格
- android Material Design:主题
- Core Animation2-CABasicAnimation
- 消息队列与RabbitMQ
- html标签应用
- JDBC——架构层、驱动
- jdk\willy\集群安装
- jquery插件编写
- 清除css、javascript及背景图在浏览器中的缓存
- iOS 7 beta4 体验
- 修改jsonb的属性
- 2016计蒜之道复赛B题:联想专卖店促销
- esp8266 终于装上固件了!半个月了!开始进军简单粗暴的lua语言!!
- 《React设计模式与最佳实践》笔记
- 可持久化 trie 的简单入门
热门文章
- RHEL5.8上SAMBA源码修改打包安装流程
- 【HEVC帧间预测论文】P1.6 A Fast HEVC Inter CU Selection Method Based on Pyramid Motion Divergence
- JDBC优化策略总结
- 登录脚本重构by封装
- LibreOJ #109. 并查集
- systemtap执行过程中报probe timer.profile registration error
- 什么是Entitlement
- js 上传头像img
- Windows 命令收集
- 条款30:透彻了解inline的里里外外(understand the ins and outs of inlining)