Advertisement
Guest User

Untitled

a guest
May 28th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include<iostream>
  2. #include<vector>
  3. using namespace std;
  4. int main(){
  5. int x;
  6. while (cin >> x){
  7. vector<int> v(x);
  8. int s;
  9. for (int i = 0; i < x; ++i) cin >> s;
  10. bool trobat = false;
  11. if (x == 0){
  12. trobat = true;
  13. cout << "NO" << endl;
  14. }
  15. for (int i = 0; i < x && !trobat; ++i){
  16. int suma = 0;
  17. for (int j = 0; j < x; ++j){
  18. if (j != i) suma += v[j];
  19. }
  20. if (v[i] == suma){
  21. trobat = true;
  22. cout << "SI" << endl;
  23. }
  24. }
  25. if (!trobat) cout << "NO" << endl;
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement