Advertisement
KiK0S

Untitled

Mar 31st, 2021
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cmath>
  4. #include <set>
  5. using namespace std;
  6.  
  7. int main(){
  8. ifstream in("tmp_26");
  9.  
  10. int n;
  11. in >> n;
  12. cout << n << '\n';
  13. int a[5000];
  14. set<int> s;
  15. for (int i = 0; i < n; i++) {
  16. in >> a[i];
  17. s.insert(a[i]);
  18. }
  19. int counter = 0;
  20. int maxx = 0;
  21. for (int i = 0; i < n; i++) {
  22. for (int j = i + 1; j < n; j++) {
  23. if (a[i] % 2 == 0 || a[j] % 2 == 0) {
  24. continue;
  25. }
  26. int sr = (a[i] + a[j]) / 2;
  27. if (s.count(sr)) {
  28. cout << "URA\n";
  29. counter++;
  30. maxx = max(maxx, sr);
  31. break;
  32. }
  33. }
  34. }
  35. cout << counter << ' ' << maxx << '\n';
  36. in.close();
  37. return 0;
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement