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 | 7da2e1fde9e6a81847753cc356d03f1c16cbe128 (patch) | |
tree | 24419e8816fd85f15d88a83c8e641ce21174d65d /works | |
parent | 38bbf3c76f234aaba39eabf8ea90ec097ab052b2 (diff) | |
download | crupest-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.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;
+}
|