当前位置: 首页 > wzjs >正文

职业教育培训网站海南做公司网站

职业教育培训网站,海南做公司网站,腾讯云怎么备案网站吗,图书馆网站建设需求分许文章目录2025-7-15-C 学习 排序(4)P5143 攀爬者题目背景题目描述输入格式输出格式输入输出样例 #1输入 #1输出 #1说明/提示提交代码P1104 生日题目描述输入格式输出格式输入输出样例 #1输入 #1输出 #1说明/提示提交代码P1012 [NOIP 1998 提高组] 拼数题目…

文章目录

  • 2025-7-15-C++ 学习 排序(4)
  • P5143 攀爬者
    • 题目背景
    • 题目描述
    • 输入格式
    • 输出格式
    • 输入输出样例 #1
      • 输入 #1
      • 输出 #1
    • 说明/提示
    • 提交代码
  • P1104 生日
    • 题目描述
    • 输入格式
    • 输出格式
    • 输入输出样例 #1
      • 输入 #1
      • 输出 #1
    • 说明/提示
    • 提交代码
  • P1012 [NOIP 1998 提高组] 拼数
    • 题目描述
    • 输入格式
    • 输出格式
    • 输入输出样例 #1
      • 输入 #1
      • 输出 #1
    • 输入输出样例 #2
      • 输入 #2
      • 输出 #2
    • 说明/提示
    • 提交代码

2025-7-15-C++ 学习 排序(4)

  排序,end。

P5143 攀爬者

题目背景

HKE 考完 GDOI 之后跟他的神犇小伙伴们一起去爬山。

题目描述

他在地形图上标记了 NNN 个点,每个点 PiP_iPi 都有一个坐标 (xi,yi,zi)(x_i,y_i,z_i)(xi,yi,zi)。所有点对中,高度值 zzz 不会相等。HKE 准备从最低的点爬到最高的点,他的攀爬满足以下条件:

(1) 经过他标记的每一个点;

(2) 从第二个点开始,他经过的每一个点高度 zzz 都比上一个点高;

(3) HKE 会飞,他从一个点 PiP_iPi 爬到 PjP_jPj 的距离为两个点的欧几里得距离。即,(Xi−Xj)2+(Yi−Yj)2+(Zi−Zj)2\sqrt{(X_i-X_j)^2+(Y_i-Y_j)^2+(Z_i-Z_j)^2}(XiXj)2+(YiYj)2+(ZiZj)2

现在,HKE 希望你能求出他攀爬的总距离。

输入格式

第一行,一个整数 NNN 表示地图上的点数。

接下来 NNN 行,三个整数 xi,yi,zix_i,y_i,z_ixi,yi,zi 表示第 iii 个点的坐标。

输出格式

一个实数,表示 HKE 需要攀爬的总距离(保留三位小数)

输入输出样例 #1

输入 #1

5
2 2 2
1 1 1
4 4 4
3 3 3
5 5 5

输出 #1

6.928

说明/提示

对于100%的数据,1≤N≤500001\leq N\leq 500001N50000,答案的范围在 double 范围内。

提交代码

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;struct Point {int x, y, z;
};bool compare(const Point& a, const Point& b) {return a.z < b.z;
}double distance(const Point& a, const Point& b) {return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2) + pow(a.z - b.z, 2));
}int main() {int n;cin >> n;vector<Point> points(n);for (int i = 0; i < n; i++) {cin >> points[i].x >> points[i].y >> points[i].z;}sort(points.begin(), points.end(), compare);double totalDistance = 0.0;for (int i = 0; i < n - 1; i++) {totalDistance += distance(points[i], points[i + 1]);}cout << fixed << setprecision(3) << totalDistance << endl;return 0;
}

P1104 生日

题目描述

cjf 君想调查学校 OI 组每个同学的生日,并按照年龄从大到小的顺序排序。但 cjf 君最近作业很多,没有时间,所以请你帮她排序。

输入格式

输入共有 n+1n + 1n+1 行,

111 行为 OI 组总人数 nnn

222 行至第 n+1n+1n+1 行分别是每人的姓名 sss、出生年 yyy、月 mmm、日 ddd

输出格式

输出共有 nnn 行,

nnn 个生日从大到小同学的姓名。(如果有两个同学生日相同,输入靠后的同学先输出)

输入输出样例 #1

输入 #1

3
Yangchu 1992 4 23
Qiujingya 1993 10 13
Luowen 1991 8 1

输出 #1

Luowen
Yangchu
Qiujingya

说明/提示

数据保证,1<n<1001<n<1001<n<1001≤∣s∣<201\leq |s|<201s<20。保证年月日实际存在,且年份 ∈[1960,2020]\in [1960,2020][1960,2020]

提交代码

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;struct Student {string name;int year, month, day;int order;
};bool compare(const Student& a, const Student& b) {if (a.year != b.year) return a.year < b.year;if (a.month != b.month) return a.month < b.month;if (a.day != b.day) return a.day < b.day;return a.order > b.order;
}int main() {int n;cin >> n;vector<Student> students(n);for (int i = 0; i < n; i++) {cin >> students[i].name >> students[i].year >> students[i].month >> students[i].day;students[i].order = i;}sort(students.begin(), students.end(), compare);for (const auto& s : students) {cout << s.name << endl;}return 0;
}

P1012 [NOIP 1998 提高组] 拼数

题目描述

设有 nnn 个正整数 a1…ana_1 \dots a_na1an,将它们联接成一排,相邻数字首尾相接,组成一个最大的整数。

输入格式

第一行有一个整数,表示数字个数 nnn

第二行有 nnn 个整数,表示给出的 nnn 个整数 aia_iai

输出格式

一个正整数,表示最大的整数

输入输出样例 #1

输入 #1

3
13 312 343

输出 #1

34331213

输入输出样例 #2

输入 #2

4
7 13 4 246

输出 #2

7424613

说明/提示

对于全部的测试点,保证 1≤n≤201 \leq n \leq 201n201≤ai≤1091 \leq a_i \leq 10^91ai109

NOIP1998 提高组 第二题

提交代码

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>using namespace std;bool compare(const string &a, const string &b) {return a + b > b + a;
}int main() {int n;cin >> n;vector<string> nums(n);for (int i = 0; i < n; i++) {cin >> nums[i];}sort(nums.begin(), nums.end(), compare);string result;for (const string &num : nums) {result += num;}cout << (result[0] == '0' ? "0" : result) << endl;return 0;
}

文章转载自:

http://dGW3SNDw.csxLm.cn
http://NKQYopZs.csxLm.cn
http://ORQiD4Ry.csxLm.cn
http://bcKwZlMy.csxLm.cn
http://aomWXblT.csxLm.cn
http://kErCfsLn.csxLm.cn
http://SGCMaNkA.csxLm.cn
http://xChHMP0s.csxLm.cn
http://xEvG2odX.csxLm.cn
http://1Fl5lgAD.csxLm.cn
http://fJKPWe3J.csxLm.cn
http://qTDelaIR.csxLm.cn
http://RhIpBCkW.csxLm.cn
http://abuml5CE.csxLm.cn
http://tyNgDNPn.csxLm.cn
http://tvIdQyNW.csxLm.cn
http://NxsEScAM.csxLm.cn
http://en53LuR5.csxLm.cn
http://9a6R8UPQ.csxLm.cn
http://DUnMAypd.csxLm.cn
http://UF4L6sWK.csxLm.cn
http://HX6OdkxK.csxLm.cn
http://SLz0YhrV.csxLm.cn
http://xKUFEZmt.csxLm.cn
http://zY8QSJ3j.csxLm.cn
http://bWXrdto2.csxLm.cn
http://JOgRbtGn.csxLm.cn
http://QFBlylGG.csxLm.cn
http://Ne0h4M3r.csxLm.cn
http://IrYAMv7i.csxLm.cn
http://www.dtcms.com/wzjs/680921.html

相关文章:

  • 如何查询网站的备案信息网站做一样的算侵权么
  • 关于重新建设网站的申请表网站规划的要素不包括
  • 邯郸哪个公司做网站好网站 防采集
  • 怎么修改网站标题找大连做企业网站的公司
  • python做的网站多吗网站域名备案主机名
  • 陕煤建设集团韩城分公司网站企业信息公示系统 全国
  • 教育网站建设改版烟台网站建设方案策划
  • 广西建设教育协会网站搜索引擎推广效果
  • 如何建立个人免费网站用什么网站做动感相册
  • 福建泉州做网站公司微电影网站源码xiazai
  • 做电影种子下载网站违法吗网站开发建
  • 低功耗集成主板做网站成免费crm特色大爆料
  • 河北公司网站制作设计从零开始wordpress主题
  • 免费制作软件的网站建设内部网站目的
  • 诸城网站建设wordpress 阅读插件
  • 茶叶公司网站源码网站建设一百互联
  • 博罗网站建设费用h5网站建设+案例
  • 做模块高考题的网站免费网上商城
  • wordpress 全站过滤做的网站在百度找不到了
  • 深圳建站公司优化做排行网站
  • 聊天网站建设重庆广告公司十大排名
  • 快速设计网站wordpress 破解后台
  • 湘潭网站建设优等磐石网络网站设计一般包括网站结构设计
  • 个人做流量大的网站开源手机网站模板
  • 做高端生活方式的网站wordpress蜘蛛记录插件
  • 永兴做网站wordpress导航主题下载
  • 全屏网站设计尺寸网站正在建设代码
  • 网站建设后期服务收费标准怀化建设企业网站
  • wordpress 移动建站海淀中小企业网站开发
  • 建设网站写需求分析建设通网站怎么注销