跳到正文

题解

这题so easy!我不多说,直接上代码!

Swordsman_Yang2023约 1 分钟
原文
文章信息与版本

文章信息

发布
2023年5月4日
收录
2025年12月12日
更新
2026年11月16日
篇幅
约 1 分钟
题目
P1177

版本

  1. v1当前

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

struct Monkey { long long a; void read() { cin >> a; } }; Monkey m[500005];

bool cmp(Monkey a, Monkey b) { return a.a < b.a; } int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { m[i].read(); } sort (m + 1, m + n + 1, cmp); for (int i = 1; i <= n; i++) { cout << m[i].a << ” ”; } return 0; }

原文