Advertisement
Saleh127

Untitled

Apr 17th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int a[100]={0},b,c,d,e,f,i,j,k,l;
  6. cin>>b;
  7. while(b--)
  8. {
  9. cin>>c;
  10. a[c]++;
  11. }
  12. d=a[1]-a[3];
  13. e=a[4]+a[3]+(a[2]*2+max(d,0)+3)/4;
  14. cout<<e<<endl;
  15. return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement