哪里错啊,第三第四第五WA了

#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;

struct Player
{
char ID[20];
long tieCount;
};
bool IDcmp(Player p1,Player p2)
{
if (strlen(p1.ID) < strlen(p2.ID))return true;
if (strlen(p1.ID) > strlen(p2.ID))return false;

return false;

}
bool tiecmp(Player p1, Player p2)
{
if (p1.tieCount>p2.tieCount)return true;
if (p1.tieCount < p2.tieCount)return false;
if (p1.tieCount == p2.tieCount) return IDcmp(p1, p2);

return false;

}

int main()
{
int playercount = 0;
cin >> playercount;
Player p[100];
for (int i = 0; i < playercount; i++)
{
cin >> p[i].ID >> p[i].tieCount;

}
sort(p, p + playercount, tiecmp);
for (int i = 0; i < playercount; i++)
{
cout << p[i].ID << endl;

}
}

0 条评论

目前还没有评论...

信息

ID
1257
难度
6
分类
其他 | 排序 点击显示
标签
(无)
递交数
4108
已通过
1158
通过率
28%
被复制
3
上传者