summaryrefslogtreecommitdiff
path: root/acwing/1204.cpp
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
commit4fa3de11fe9b8c7436b5b5f80fee4a8b68e11b60 (patch)
treee2f5521440d842c54f1346faa522e20dd3fcd904 /acwing/1204.cpp
parent5f8f15af534e4aab617ba07d9eae3665b6a06db7 (diff)
downloadsolutions-4fa3de11fe9b8c7436b5b5f80fee4a8b68e11b60.tar.gz
solutions-4fa3de11fe9b8c7436b5b5f80fee4a8b68e11b60.tar.bz2
solutions-4fa3de11fe9b8c7436b5b5f80fee4a8b68e11b60.zip
Add acwing 1204.
Diffstat (limited to 'acwing/1204.cpp')
-rw-r--r--acwing/1204.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/acwing/1204.cpp b/acwing/1204.cpp
new file mode 100644
index 0000000..e3e5395
--- /dev/null
+++ b/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;
+}