_takumi

weird26

Mar 31st, 2021
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include "pch.h"
  2. #include <algorithm>
  3. #include <iostream>
  4. #include <fstream>
  5. #include <vector>
  6. using namespace std;
  7.  
  8. int main() {
  9.     ifstream input("\\\\lit.msu.ru\\Storage\\Students\\!Common\\11 класс ИНФОРМАТИКА\\Файлы для диагностической работы 31.03.2021 ЕГЭ информатика\\26\\26.txt");
  10.     vector<int> v;
  11.     vector<int> data;
  12.     int a, b;
  13.     while (input >> a) data.push_back(a);
  14.     for (int i = 0; i < data.size(); i++) {
  15.         if (data[i] & 1) continue;
  16.         for (int j = 0; j < data.size(); j++) {
  17.             if (data[j] == data[i] || (data[j] & 1)) continue;
  18.             v.push_back((data[i] + data[j]) / 2);
  19.         }
  20.     }
  21.     sort(begin(v), end(v));
  22.     for (size_t i = v.size() - 1; i >= 0; i--)
  23.     {
  24.         if (find(begin(data), end(data), v[i]) != end(data)) {
  25.             cout << v[i];
  26.             break;
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment