Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- signed main() {
- int n;
- cin >> n;
- vector <int> a(n);
- for (int& x : a) {
- cin >> x;
- }
- int x, y, ans = 0;
- for (int i = 0; i < n; i++) {
- for (int j = 1; j < n; j++) {
- if (a[i] > a[j]) {
- if ((a[i] + a[j]) % 120 == 0 && a[i] + a[j] > ans) {
- x = a[i], y = a[j];
- ans = a[i] + a[j];
- }
- }
- }
- }
- cout << x << " " << y << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement