diff options
author | crupest <crupest@outlook.com> | 2021-02-25 23:07:24 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-02-25 23:07:24 +0800 |
commit | 4fa3de11fe9b8c7436b5b5f80fee4a8b68e11b60 (patch) | |
tree | e2f5521440d842c54f1346faa522e20dd3fcd904 /acwing | |
parent | 5f8f15af534e4aab617ba07d9eae3665b6a06db7 (diff) | |
download | solutions-4fa3de11fe9b8c7436b5b5f80fee4a8b68e11b60.tar.gz solutions-4fa3de11fe9b8c7436b5b5f80fee4a8b68e11b60.tar.bz2 solutions-4fa3de11fe9b8c7436b5b5f80fee4a8b68e11b60.zip |
Add acwing 1204.
Diffstat (limited to 'acwing')
-rw-r--r-- | acwing/1204.cpp | 31 |
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;
+}
|