You are viewing a single comment's thread. Return to all comments →
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <limits.h> #define subtract(a, b) a-b using namespace std; int main() { int n; cin >> n; vector<int> v(n); for(int i = 0; i < n; i++){ cin >> v[i]; } int maxi = INT_MIN; int mini = INT_MAX; for(int i = 0; i < n; i++){ if(v[i] > maxi) maxi = v[i]; if(v[i] < mini) mini = v[i]; } cout << "Result = " << subtract(maxi, mini) << endl; return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Preprocessor Solution
You are viewing a single comment's thread. Return to all comments →