From 4e6460616480cfd9ce844d1c313879c396d53f97 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Wed, 22 Dec 2021 16:25:45 +0800 Subject: [PATCH] =?UTF-8?q?P1059=20[NOIP2006=20=E6=99=AE=E5=8F=8A=E7=BB=84?= =?UTF-8?q?]=20=E6=98=8E=E6=98=8E=E7=9A=84=E9=9A=8F=E6=9C=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R65563173 --- Luogu/P1059/P1059.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Luogu/P1059/P1059.cpp diff --git a/Luogu/P1059/P1059.cpp b/Luogu/P1059/P1059.cpp new file mode 100644 index 00000000..17363a7a --- /dev/null +++ b/Luogu/P1059/P1059.cpp @@ -0,0 +1,26 @@ +#include +#include +#include + +using std::cin; +using std::cout; +using std::endl; + +int n, x; +std::vector a; + +int main() { + cin >> n; + for (int i = 0; i < n; i++) { + cin >> x; + a.push_back(x); + } + std::sort(a.begin(), a.end()); + a.erase(std::unique(a.begin(), a.end()), a.end()); + cout << a.size() << endl; + for (int i : a) { + cout << i << ' '; + } + cout << endl; + return 0; +}