C++面向对象程序设计 042:热血格斗场 ---- (北大Mooc)
发布日期:2021-06-30 22:27:58 浏览次数:2 分类:技术文章

本文共 614 字,大约阅读时间需要 2 分钟。

文章目录


专题博客链接


原题题目

在这里插入图片描述

在这里插入图片描述


代码实现(900ms)

#include 
#include
#include
#include
using namespace std;typedef map
mmii;int main(){
int members,id,attack; cin>>members; string func; mmii boxingmap; mmii::iterator p1,p2; boxingmap.insert(make_pair(1000000000,1)); while(members--) {
cin>>id>>attack; p1 = boxingmap.lower_bound(attack); p2 = boxingmap.upper_bound(attack); if(p1 == boxingmap.begin() || abs((--p1)->first-attack) > abs(p2->first-attack)) p1 = p2; cout<
<<' '<
second<

提交结果

在这里插入图片描述

转载地址:https://love6.blog.csdn.net/article/details/115050310 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:C++面向对象程序设计 043:冷血格斗场 ---- (北大Mooc)
下一篇:C++面向对象程序设计 041:Set ---- (北大Mooc)

发表评论

最新留言

表示我来过!
[***.240.166.169]2024年04月28日 21时41分42秒