Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, x, i;
- int maxch = 0, maxch33 = 0, maxnech = 0, maxnech33 = 0, maxs = 0, elem1 = 0, elem2 = 0;
- cin >> n;
- for (i = 0; i < n; i++)
- {
- cin >> x;
- if (x % 2 == 0)
- {
- if (x % 33 == 0 && x + maxch > maxs && maxch > 0) {
- maxs = x + maxch; elem1 = maxch; elem2 = x;
- }
- if (x % 33 != 0 && x + maxch33 > maxs && maxch33 > 0) {
- maxs = x + maxch33; elem1 = maxch33; elem2 = x;
- }
- }
- if (x % 2 != 0)
- {
- if (x % 33 == 0 && x + maxnech > maxs && maxnech > 0) {
- maxs = x + maxnech; elem1 = maxnech; elem2 = x;
- }
- if (x % 33 != 0 && x + maxnech33 > maxs && maxnech33 > 0) {
- maxs = x + maxnech33; elem1 = maxnech33; elem2 = x;
- }
- }
- if (x % 2 == 0 && x > maxch) maxch = x;
- if (x % 2 == 0 && x % 33 == 0 && x > maxch33) maxch33 = x;
- if (x % 2 != 0 && x > maxnech) maxnech = x;
- if (x % 2 != 0 && x % 33 == 0 && x > maxnech33) maxnech33 = x;
- }
- if (maxs > 0) cout << elem1 << " " << elem2;
- else cout << "00";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement