Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cmath>
- #include <set>
- using namespace std;
- int main(){
- ifstream in("tmp_26");
- int n;
- in >> n;
- cout << n << '\n';
- int a[5000];
- set<int> s;
- for (int i = 0; i < n; i++) {
- in >> a[i];
- s.insert(a[i]);
- }
- int counter = 0;
- int maxx = 0;
- for (int i = 0; i < n; i++) {
- for (int j = i + 1; j < n; j++) {
- if (a[i] % 2 == 0 || a[j] % 2 == 0) {
- continue;
- }
- int sr = (a[i] + a[j]) / 2;
- if (s.count(sr)) {
- cout << "URA\n";
- counter++;
- maxx = max(maxx, sr);
- break;
- }
- }
- }
- cout << counter << ' ' << maxx << '\n';
- in.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement