_takumi

num27.1

Oct 22nd, 2020
2,105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int now = 0, a = 0, b = 0;
  8.     ifstream input("C:\\Users\\Максим\\Downloads\\27986_B.txt");
  9.     while (input >> now && now != 0) {
  10.         if (now % 7 == 0 && now % 49 != 0 && now > a) {
  11.             a = now;
  12.         }
  13.         else if (now % 7 != 0 && now > b) {
  14.             b = now;
  15.         }
  16.     }
  17.     cout << ((a * b == 0) ? 1 : a * b);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment