科大讯飞 球赛 0%过

感觉把所有都考虑了,包括积分相同考虑净胜球,净胜球数相同考虑总进球数
但是,实在不懂为什么一直是0%,贴上代码
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>

using namespace std;

int n;
vector<string> clubs;
vector<pair<string, vector<int>> > newclubs;    // vector jf p-n p
map<string, vector<int>> cnts;

bool Cmp(pair<string, vector<int>> mp1, pair<string, vector<int>> mp2)
{     if (mp1.second[0] > mp2.second[0])         return true;     if (mp1.second[0] == mp2.second[0])     {         if (mp1.second[1] > mp2.second[1])             return true;         if (mp1.second[1] == mp2.second[1])             if (mp1.second[2] > mp2.second[2])                 return true;     }     return false;
}

void GetNewClub()
{     clubs.clear();     newclubs.clear();     cnts.clear();     cin >> n;     clubs = vector<string>(n, "");     int i;     string ab, a, b, xy;     string x, y;     char fg = '-';     char fg2 = ':';     for (i = 0; i < n; i++)     {         cin >> clubs[i];         cnts.insert(make_pair(clubs[i], vector<int>(3, 0)));     }     for (i = 0; i < n*(n-1)/2; i++)     {         cin >> ab >> xy;         int posi = ab.find(fg);         a = ab.substr(0, posi);         b = ab.substr(posi+1);         int posi2 = xy.find(fg2);         x = xy.substr(0, posi2);         y = xy.substr(posi2+1);         if (x > y)         {             cnts[a][0] += 3;             cnts[a][1] += atoi(x.c_str())-atoi(y.c_str());             cnts[a][2] += atoi(x.c_str());             cnts[b][1] += atoi(y.c_str())-atoi(x.c_str());             cnts[b][2] += atoi(y.c_str());         }         else if (x < y)         {             cnts[a][1] += atoi(x.c_str())-atoi(y.c_str());             cnts[a][2] += atoi(x.c_str());             cnts[b][0] += 3;             cnts[b][1] += atoi(y.c_str())-atoi(x.c_str());             cnts[b][2] += atoi(y.c_str());         }         else         {             cnts[a][0] += 1;             cnts[a][1] += atoi(x.c_str())-atoi(y.c_str());             cnts[a][2] += atoi(x.c_str());             cnts[b][0] += 1;             cnts[b][1] += atoi(y.c_str())-atoi(x.c_str());             cnts[b][2] += atoi(y.c_str());         }     }     for (auto &a : cnts)         newclubs.push_back(make_pair(a.first, a.second));     sort(newclubs.begin(), newclubs.end(), Cmp);         clubs.clear();     for (i = 0; i < n/2; i++)         clubs.push_back(newclubs[i].first);          sort(clubs.begin(), clubs.end());     for (auto &a : clubs)         cout << a << endl;     return;
}

int main()
{     while (1)     {         GetNewClub();     }         return 0;
}

全部评论
百度搜索净胜球就知道了
点赞 回复 分享
发布于 2017-09-16 17:23
我也是,本地都测试通过,提交就显示输出超过什么的,烦人
点赞 回复 分享
发布于 2017-09-16 17:15
因为最后输出是按字母顺序,而不是得分顺序。  我也是做完才发现这个问题。
点赞 回复 分享
发布于 2017-09-16 17:13
大兄弟排下版啊
点赞 回复 分享
发布于 2017-09-16 17:13
百分之零的飘过 同样不知道错误原因
点赞 回复 分享
发布于 2017-09-16 17:12

相关推荐

已oc&nbsp;云智断更了好几天,也有一些话想说,继续更新一篇云智timeline&nbsp;4.18&nbsp;一面&nbsp;半个小时后约二面&nbsp;4.21二面&nbsp;当晚&nbsp;约hr面&nbsp;4.23hr面&nbsp;4.30&nbsp;发offer之前美团的二面挂了,进入人才库,后面又被捞起来面试,4.30号&nbsp;美团又一面,现在还没出一面结果感觉也不报什么希望,就算一面过了,还有二面,我经不起深入拷打,唉,真的,好难五一躺平了五天,吃吃玩玩睡睡~还要担心毕业,科研更是难,唉暑期可能就到此为止了,后面没有时间在这个上面了,要抓紧时间做科研,为了后面能出去实习。大厂,秋招再见!!!有一些感慨:4.1是我的第一次面试,美团,面试的时候紧张到浑身发...
daisy9542:我今晚也是美团一面,已经第六次了。我也面了其他的,没拿到 offer。但我想开了,要按照自己的节奏来,找暑期转正然后秋招大杀四方并不是唯一的出路,其实还有很多选择的,有 0 实习最后秋招拿 offer 了,也有不选择互联网去国企的外企的,考编的,创业的。现在的失败不代表以后的路都是黑暗的,只不过可能运气还没降临到头上。所以现在要做的,就是放平心态,提升自己,通过面试了解到自己的优点和不足,争取下次机会来了能好好抓住
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务