Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <algorithm>
- #include <string>
- #include <fstream>
- #include <sstream>
- #include <set>
- using namespace std;
- ifstream in("input.txt");
- ofstream out("output.txt");
- int main() {
- set <int> chet;
- set <int> nechet;
- string s;
- int f = 0;
- int k;
- while (getline(in, s)) {
- stringstream sin(s);
- while (sin >> k) {
- if (f % 2 == 0) {
- chet.insert(k);
- }
- else {
- nechet.insert(k);
- }
- }
- f++;
- }
- for (auto it : nechet) {
- chet.erase(it);
- }
- for (auto it : chet) {
- out << it << " ";
- }
- }
- 455 455
- 455
- 2121
- 0
- 666 33 288
- 3100
- 555
- 555 555
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement