Shaolin HDU 4585

导航系统中坐标系介绍 日常开发中常用到八大坐标系: 1. 惯性坐标系 圆心是地球的原点,Z轴沿地轴方向朝向北极, X轴和Y轴位于赤道平面内,与Z轴满足右手法则,并且X轴和Y轴分别指向两个恒星。也就是说不随着地球的自转而发生变化。它是一个非常固定的坐标系。IMU测量得到的加速度,角速度都是相对于这个坐标系的。 特点:xy不动,不随着地球的自转而转动,可以作为地球附近传感器输出的惯性坐标系。 在导航中,有: 载体在导航系下的角速度 = 载体相对惯性系的角速度 – 导航系相对于惯性系的角速度 2. 地球坐标系 地球坐标系用oxey 阅读详情

Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K
(Java/Others) Total Submission(s): 5801 Accepted Submission(s):
2526

Problem Description Shaolin temple is very famous for its Kongfu
monks.A lot of young men go to Shaolin temple every year, trying to be
a monk there. The master of Shaolin evaluates a young man mainly by
his talent on understanding the Buddism scripture, but fighting skill
is also taken into account. When a young man passes all the tests and
is declared a new monk of Shaolin, there will be a fight , as a part
of the welcome party. Every monk has an unique id and a unique
fighting grade, which are all integers. The new monk must fight with a
old monk whose fighting grade is closest to his fighting grade. If
there are two old monks satisfying that condition, the new monk will
take the one whose fighting grade is less than his. The master is the
first monk in Shaolin, his id is 1,and his fighting grade is
1,000,000,000.He just lost the fighting records. But he still
remembers who joined Shaolin earlier, who joined later. Please recover
the fighting records for him.

Input There are several test cases. In each test case: The first line
is a integer n (0 <n <=100,000),meaning the number of monks who joined
Shaolin after the master did.(The master is not included).Then n lines
follow. Each line has two integer k and g, meaning a monk’s id and his
fighting grade.( 0<= k ,g<=5,000,000) The monks are listed by
ascending order of jointing time.In other words, monks who joined
Shaolin earlier come first. The input ends with n = 0.

Output A fight can be described as two ids of the monks who make that
fight. For each test case, output all fights by the ascending order of
happening time. Each fight in a line. For each fight, print the new
monk’s id first ,then the old monk’s id.

Sample Input

3 2 1 3 3 4 2 0

Sample Output

2 1 3 2 4 2

用map可以很简单做出来,Treap树正在学,学会了在再继续补充这道题。

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <math.h>
#include <bitset>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include<functional>
#include<time.h>
#include<stdlib.h>
#include<time.h>
#include <climits>
using namespace std;
#define MEM(a,x) memset(a,x,sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define ll long long
#define EXP 1e-8
#define lowbit(x) (x&-x)
#define debug(x) cout<<x<<' ';
const int maxn = 1e6;
map<int, int >mp;
int main(){
    int n;
    while (cin >> n)
    {
        mp.clear();
        mp[1000000000] = 1;
        while (n--)
        {
            int id, g;
            cin >> id >> g;
            mp[g] = id;
            int ans;
            map<int, int>::iterator it = mp.find(g); //it指向最新的战斗等级;
            if (it == mp.begin()) ans = (++it)->second;
            else
            {
                map<int, int>::iterator it2 = it;
                it2--;
                it++;
                if (g - it2->first <= it->first - g)
                    ans = it2->second;
                else ans = it->second;
            }
            cout << id << ' ' << ans << endl;
        }
        map<int, int>::iterator it = mp.begin();
        for (; it != mp.end(); it++)
        {
            cout << it->first << ' ' << it->second << endl;;
        }
    }
    return 0;
}
osg点云加载与渲染 阅读详情

相关推荐

LaTeX公式转Word竟这么简单?Python三行代码实现学术论文格式无忧

本文介绍如何利用Python的latex2word库,仅需三行代码即可将LaTeX数学公式精准转换为Word原生Office Math对象,解决学术写作中LaTeX与Word格式割裂的难题。该方法支持批量处理、格式保真,并能与Markdown、Jupyter Notebook等工具集成,构建自动化写作流程,实现学术论文格式无忧。

qsc90123456的博客 306

HDU4585 Shaolin

HDU4585 Shaolin 题意 少林寺以武僧闻名,每年都有很多年轻人去少林寺出家。少林大师对一个年轻人的评价主要是看他对佛经的理解能力,但也要考虑他的打斗技巧。当一个年轻人通过了所有的测试并被宣布为少林新和尚时,将会有一场战斗,作为欢迎派对的一部分。每个和尚都有一个唯一的身份证和一个唯一的战斗等级,都是整数。新和尚必须与战斗等级最接近他的老和尚战斗。如果有两个老和尚满足这一条件,新和尚将采...

Do It Youself! 358

【JS】自定义上传组件,文件上传与回显,自定义进度条显示(基于element-plus与axios)

公司是做B 端产品的,有sass平台也有源码交付的项目,最近开发了很多小系统,这里记录一下开发遇到的问题。 需要定制一个上传组件,要求可以自定义文件存储路径,自定义可上传的文件类型,限制文件大小等,并且提供基础的文件回显功能,例如上传一张图片到服务器指定目录的`/file`文件夹下面,并且实现可以查看预览的功能。

余浩的博客 1172

hdu 4585 Shaolin(二分)

题目链接:hdu 4585 Shaolin 题目大意:在一个寺庙里有个和尚,序号为1,法力非常高,接下来会有n个和尚来到寺庙,每次有和尚来到寺庙,都会向寺庙中的和尚发起挑战,每行给出和尚的序号和法力,挑战的和尚会挑选寺庙中法力和自己最接近的,如果可以,还会挑法力比自己低的(即最近的情况有比自己高的和比自己低的),给出每个和尚做挑战和尚的序号。 解题思路:二分搜索,有set完

不慌不忙、不急不躁 1601

Win10更新后黑屏只剩鼠标?火绒误杀explorer.exe的5种自救方案(附详细步骤)

本文详细介绍了Win10更新后出现黑屏只剩鼠标的5种专业修复方案,重点解决火绒误杀explorer.exe的问题。从基础的任务管理器操作到安全模式下的系统修复,再到注册表编辑和系统还原,提供了全面的解决方案,帮助用户快速恢复系统正常运行。

weixin_29306571的博客 671

深度学习的unfold操作

对于彩色图像这样的三维数据,unfold操作会对每个通道分别进行上述的二维展开操作。例如,一个 RGB 图像,在对其进行unfold操作时,红色通道、绿色通道和蓝色通道的数据都会被独立地按照定义的窗口和步长展开,然后将这些展开后的通道数据按照原来的通道顺序组合在一起,形成新的张量。与我们熟悉的卷积类似,unfold也是使用一个特定大小的窗口和步长自左至右、自上至下滑动,不同的是,卷是滑动后与核求乘积(所以取名为卷积),而unfold滑动后不求乘积,是将窗口内的数据展开。

xulibo5828的博客 2177

HDU_4585_Shaolin

HDU_4585_Shaolin 题意:少林寺招新,起初只有一个id为1武力值为1000000000的老和尚,现在要招一些新和尚,每个和尚入寺考核要和已经入寺的和尚比武且只和武力值与他相差最小的比武,当有两个和尚与他武力值差值相同时(比如大1和小1)便在这些差值相同的和尚里只和比他小的比武。 思路:用STL中的映射,用武力值作为键,然后找已入寺的和尚比武时用lower_bound

Sothan 869

2025国赛数学建模A题 完整Python代码 烟幕干扰弹的投放策略

常量定义G = 9.8 # 重力加速度 m/s²V_SMOKE_SINK = 3 # 烟幕下沉速度 m/sMISSILE_SPEED = 300 # 导弹速度 m/sEFFECTIVE_RADIUS = 10 # 有效遮蔽半径 mEFFECTIVE_DURATION = 20 # 有效遮蔽时间 sTARGET_POS = np.array([0, 200, 0]) # 目标位置FALSE_TARGET_POS = np.array([0, 0, 0]) # 假目标位置# 初始位置。

YOLO 1116

hdu 4585 Shaolin 2013 ACM-ICPC杭州赛区全国邀请赛——题目重现

实际上要做题目就是要进行快速的查找和插入,这个功能可以用set来实现 所代码就很好写了 /********* PRO: hdu 4585 TIT: Shaolin DAT: 2013-08-10-12.28 AUT: UKean EMA: huyocan@163.com *********/ #include #include #include #define INF 1e18 using n

柯安的专栏 1726

Buck电源设计常见的一些问题(五)MOS管振荡抑制方法(三)

关于开关节点振荡的产生机制和抑制问题,总结了三种抑制方法。第一种方法是利用输入端的高频去耦电容;第二种方法是设计 RC 缓冲电路;第三种方法是优化自举电路的串联电阻。以上三种方法均通过实验加以验证,对开关节点振荡具有很好的抑制作用。应该综合同步 Buck 变换器的各项指标权衡设计。

小幽余生不加糖 1645

第一章:基础知识 - 概念与基础,理解什么是功耗

电源管理与功耗调优:实战项目经验分享

坚韧与专注 894

hdu4585 shaolin Treap

Shaolin Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 1945    Accepted Submission(s): 836 Problem Description Shaolin temple is very

Magle 954

可编程逻辑控制器(PLC)系列:Mitsubishi MELSEC-Q_(8).MELSEC-Q系列PLC故障诊断与维护

MELSEC-Q系列PLC的故障诊断与维护是一个系统性的过程,需要工程师具备扎实的理论基础和丰富的实践经验。通过了解故障类型、使用诊断工具、遵循诊断步骤,可以有效地定位和解决故障问题。同时,定期的检查与保养、备份与恢复、优化程序和配置,以及提供良好的运行环境,可以减少故障的发生,提高系统的可靠性。希望本文能够帮助工程师在故障诊断与维护过程中更加得心应手,确保MELSEC-Q系列PLC的稳定运行。

2401_87715305的博客 1256

hdu 4585 Shaolin

Shaolin Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Problem Description Shaolin temple is very famous for its Kongfu monks.A lot of young men go to Shaolin temple every year, trying to be a monk there. The master of

GitHub:https://github.com/myp020301 319

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

HDU 4585 Shaolin

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4585 题记:用map存下和尚的等级和id,之后用迭代器找出最等级最接近的两个然后比较即可。 #include<bits/stdc++.h> using namespace std; map<int,int>mp; int main(){ int n; while...

moyangxian 255

inori mmd 7z

楪祈的模型资源....................................................................................................................................................................................................................

HDU 4585 Shaolin (STL)

Shaolin Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 315    Accepted Submission(s): 162 Problem Description Shaolin temple is very famous ...

weixin_34161064的博客 182

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

HDU4585 Shaolin——map、treap

传送门 Problem Description Shaolin temple is very famous for its Kongfu monks.A lot of young men go to Shaolin temple every year, trying to be a monk there. The master of Shaolin evaluates a young man mainly by his talent on understanding the Buddism scriptur

lllllan 227

HDU 4585 Shaolin(map用法)

传送门:http://acm.hdu.edu.cn/showproblem.php?pid=4585 思路:首先要知道map<key,value>是会自动对key值排序的,map实质上就是一棵红黑树(忘了在哪看过)。lower_bound()也是关于key值来查找。 #include<iostream> #include<cstring> #include...

诗鸩的博客 200

[HDU4585]Shaolin

Problem 问你一个数的前驱和后继 Solution Treap模板题 Notice 注意输出那个人的编号 Code #include<cmath> #include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #include<algo...

Q882199的博客 217

HDU 4585- Shaolin

J - Shaolin Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4585 Description Shaolin temple is very famous for its Kongfu monk

qq_18661257的专栏 874

treap树:hdu 4585 Shaolin

二叉搜索树 treap树

weixin_46266058的博客 576

HDU 4585 Shaolin(Treap)

题目链接:点击打开链接 题意: 少林寺的每个和尚均有编号和战斗等级,新来的小和尚均要和老和尚比试,从老和尚中选和自己的战斗等级相差最少的比,如果有两个,选比自己战斗等级小的和尚。每个和尚的编号和战斗等级均唯一。 其实这是个水题,直接用map即可,但为了练习Treap,采用Treap方法。 可以想到采用的数据结构要能动态的维护一个有序序列(战斗等级,由于战斗等级和编号为一对一映射,直接维护战

不忘初心 524

【STL】hdu 4585 Shaolin

map的应用

Gzbgreat的博客 335

HDU4585 Shaolin(treap)

题目链接 Input There are several test cases. In each test case: The first line is a integer n (0 The monks are listed by ascending order of jointing time.In other words, monks who joined S

HOrchard 399

HDU 4585——Shaolin

stl map http://blog.csdn.net/dongdongzhang_/article/details/9884345 #include #include #include #include #include #include #include #include #include #include #include #include using nam

817
上一篇: HDU 2082 找单词
下一篇: 模板
Phantom_matter
博客等级 码龄7年 29粉丝 147原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值