Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int i, k, N, maxs, x, min;
  6. k = 0; maxs = 0; x = 0; min = 1000000;
  7. int a[10];
  8. cin >> N;
  9. for (i = 0; i < 10; i++)
  10. {
  11. a[i] = 0;
  12. }
  13. for (i = 1; i <= N; i++)
  14. {
  15. cin >> x;
  16. if (x < min)
  17. {
  18. min = x;
  19. k = i;
  20. }
  21. a[i] = x;
  22. }
  23. for (i = 1; i <= N; i++)
  24. {
  25. maxs = maxs + a[i];
  26. }
  27. if (maxs % 2 == 0)
  28. {
  29. maxs = maxs - min;
  30. a[k] = 0;
  31. }
  32. for (i = 1; i <= N; i++)
  33. {
  34. if (a[i] > 0)
  35. {
  36. cout << i << endl;
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement