Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- #define NMAX 15000
- #define INFILE "BAC.IN"
- int cifra(int x)
- {
- if (!x)
- return 0;
- while (x)
- {
- if ((x % 10) % 2 == 0)
- return x % 10;
- x /= 10;
- }
- return -1;
- }
- int n, m, v[NMAX];
- int main()
- {
- ifstream fin(INFILE);
- fin >> n;
- for (int i = 0; i < n; i++)
- {
- int x;
- fin >> x;
- int u = cifra(x);
- if (u != -1)
- v[m++] = u;
- }
- int sor = 0;
- while (!sor)
- {
- sor = 1;
- for (int i = 0; i < m - 1; i++)
- if (v[i] < v[i + 1])
- {
- swap(v[i], v[i + 1]);
- sor = 0;
- }
- }
- for (int i = 0; i < m; i++)
- cout << v[i];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement