Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
376 B
1
Indexable
Never
//домашка
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int n, min, max, a;
    cin >> n;
    min = INT32_MAX;
    max = INT32_MIN;
    while (n > 0)
    {
        n--;
        cin >> a;
        if (min > a)
            min = a;
        if (max < a)
            max = a;
        cout << max - min;
    }
    return 0;
}
Leave a Comment