文章
10
粉丝
10
获赞
2
访问
4.1k
首先是能通过给的示例样例,居然还是wrong answer
还有就是把网上所有方法找了,都是wrong answer
假设网站自己的测试数据有误吧,下面上我的思路和代码:
#include
#include
#include
#include
using namespace std;
vector str;
struct Res {
string small;
string big;
int distance;
};
int cnt_distance(string a, string b)
{
int cnt = 0;
for (int i = 0; i < a.size(); i ++)
{
if (a[i] != b[i]) cnt ++;
}
return cnt;
}
bool compare(const Res& a, const Res& b)
{
if (a.distance == b.distance)
{
if (a.small == b.small)
return a.big < b.big;
return a.small < b.small;
}
return a.distance < b.distance;
}
int main()
{
int N;
cin >> N;
vector results; //用来存最后要输出的六条数据
string a;
for (int i = 0; i < N; i ++) cin >> a, str.push_back(a);
for (int i = 0; i + 1 < str.size(); i ++)
for (int j = i + 1; j < str.size(); j ++)
...
登录后发布评论
暂无评论,来抢沙发