2char专题

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

题目链接 题意:给出n个单词,只有小写字母组成,然后问如何选择单词,使得组成的长度最长,且组合出的串最多只能有2个字母不同。 解法:暴力枚举2个字母的组合情况,然后在判断。 #include<bits/stdc++.h>using namespace std;const int maxn=10005;const int inf=1<<27;string str[maxn];int