Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int now = 0, maximum = 0, mod14 = 0, mod7 = 0, mod2 = 0;
- ifstream input("C:\\Users\\Максим\\Downloads\\27-A_2.txt");
- input >> now;
- while (input >> now) {
- if (now % 14 == 0 && now > mod14) {
- mod14 = now;
- }
- else {
- if (now > maximum) {
- maximum = now;
- }
- if (now % 7 == 0 && now > mod7) {
- mod7 = now;
- }
- else if (now % 2 == 0 && now > mod2) {
- mod2 = now;
- }
- }
- }
- cout << max(mod7 * mod2, mod14 * maximum);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement