Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- int n;
- std::cin >> n;
- int b = 0;
- for (int i = 0; i < n; ++i)
- {
- int k = 0;
- int x;
- std::cin >> x;
- while (1)
- {
- if (x % 4 == 0)
- {
- if (x / 1000 == 4 || x / 1000 == 5)
- {
- k = 1;
- }
- else
- {
- k = 2;
- break;
- }
- }
- if (x % 7 == 0)
- {
- if (x / 1000 == 7 || x / 1000 == 1)
- {
- k = 1;
- }
- else
- {
- k = 2;
- break;
- }
- }
- if (x % 9 == 0)
- {
- if (x / 1000 == 9 || x / 1000 == 8)
- {
- k = 1;
- }
- else
- {
- k = 2;
- break;
- }
- }
- if (x % 9 != 0 || x % 7 != 0 || x % 4 != 0)
- {
- k = 1;
- break;
- }
- break;
- }
- if (k == 2)
- {
- std::cout << x << " ";
- }
- else
- {
- ++b;
- }
- }
- if (b == n)
- {
- std::cout << 0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement