Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int num;
- cin >> num;
- int sum = 0;
- int maxNum = 0;
- int number;
- for (int i = 0; i < num; i++) {
- cin >> number;
- sum += number;
- if (number > maxNum) {
- maxNum = number;
- }
- }
- int result = sum - maxNum;
- if (maxNum == result) {
- cout << "Yes\n" << "Sum = " << maxNum << endl;
- }
- else {
- cout << "No\n" << "Diff = " << abs(maxNum - result) << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement