Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- double topNumber;
- double bottomNumber;
- double total=0;
- double max = INT_MIN;
- double min = INT_MAX;
- int sum = 0;
- int maxDiff = 0;
- for (int i = 1; i <= n; i++)
- {
- cin >> topNumber;
- cin >> bottomNumber;
- total = topNumber + bottomNumber;
- sum = sum + total;
- if (total > max)
- {
- max = total;
- }
- if (total < min)
- {
- min = total;
- }
- }
- maxDiff = max - min;
- if (sum % n == 0&&sum!=0)
- {
- cout << "Yes, value=" << sum / n << endl;
- }
- else
- {
- cout << "No, maxdiff=" << maxDiff << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement