Advertisement
askarulytarlan

Untitled

Feb 10th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int n;
  7. int a[n];
  8. cin >> n;
  9. int cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0, cnt = 0;
  10. for(int i = 0; i < n; i++){
  11. cin >> a[i];
  12. if(a[i] == 1){
  13. cnt1++;
  14. cnt++;
  15. }
  16. else if(a[i] == 2){
  17. cnt2++;
  18. cnt++;
  19. }
  20. else if(a[i] == 3){
  21. cnt3++;
  22. cnt++;
  23. }
  24. else{
  25. cnt4++;
  26. }
  27. }
  28. int sum = cnt4;
  29. if(cnt3 > cnt1){
  30. sum += (cnt3-cnt1);
  31. }
  32. else if(cnt3 == cnt1){
  33. sum += cnt3;
  34. }
  35. else if(cnt3 < cnt1){
  36. cnt += (cnt1-cnt3);
  37. }
  38. cout << cnt4 + ;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement