aboutsummaryrefslogtreecommitdiff
path: root/works
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-02-25 23:07:24 +0800
committercrupest <crupest@outlook.com>2021-02-25 23:07:24 +0800
commit7da2e1fde9e6a81847753cc356d03f1c16cbe128 (patch)
tree24419e8816fd85f15d88a83c8e641ce21174d65d /works
parent38bbf3c76f234aaba39eabf8ea90ec097ab052b2 (diff)
downloadcrupest-7da2e1fde9e6a81847753cc356d03f1c16cbe128.tar.gz
crupest-7da2e1fde9e6a81847753cc356d03f1c16cbe128.tar.bz2
crupest-7da2e1fde9e6a81847753cc356d03f1c16cbe128.zip
import(solutions): Add acwing 1204.
Diffstat (limited to 'works')
-rw-r--r--works/solutions/acwing/1204.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/works/solutions/acwing/1204.cpp b/works/solutions/acwing/1204.cpp
new file mode 100644
index 0000000..e3e5395
--- /dev/null
+++ b/works/solutions/acwing/1204.cpp
@@ -0,0 +1,31 @@
+#include <ios>
+#include <iostream>
+#include <set>
+
+int main() {
+ std::ios_base::sync_with_stdio(false);
+
+ int repeat;
+
+ int n;
+ std::cin >> n;
+
+ std::set<int> ids;
+
+ while (std::cin >> n) {
+ auto result = ids.insert(n);
+ if (!result.second)
+ repeat = n;
+ }
+
+ auto iter = ids.cbegin();
+
+ int last = *iter++;
+
+ while (++last == *iter++)
+ ;
+
+ std::cout << last << ' ' << repeat;
+
+ return 0;
+}