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 | 5f0f4b76373db9dda9b9b8855339614dacc9c3b3 (patch) | |
tree | a770425c95d340b0d642d59e128164364453092a | |
parent | 723d4b75c6cfaa592e7ce8dcd9abdcdf48fcc244 (diff) | |
download | crupest-5f0f4b76373db9dda9b9b8855339614dacc9c3b3.tar.gz crupest-5f0f4b76373db9dda9b9b8855339614dacc9c3b3.tar.bz2 crupest-5f0f4b76373db9dda9b9b8855339614dacc9c3b3.zip |
import(solutions): Add acwing 1204.
-rw-r--r-- | works/solutions/acwing/1204.cpp | 31 |
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;
+}
|