Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int ncif(int x) {
- int c = 0;
- while (x) {
- c++;
- x /= 10;
- }
- return c;
- }
- int main() {
- ifstream f("atestat.in");
- ofstream g("atestat.out");
- int x, max = -1, min = 9999, n;
- f >> n;
- for (int i = 1; i <= n; i++) {
- f >> x;
- if (x % 2)
- g << ncif(x) << ' ';
- if (x < min)
- min = x;
- if (x > max)
- max = x;
- }
- g << endl;
- if (!min && max)
- g << max;
- else
- if (min && !max)
- g << min;
- else {
- while (min != max) {
- if (max > min)
- max -= min;
- else
- min -= max;
- }
- g << max;
- }
- f.close();
- g.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement