SHARE
TWEET

Untitled

nooobiiee Mar 26th, 2020 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int t,n,ck=0,count=0;
  6.     double arr[5]={0};
  7.     double sum=0;
  8.  
  9.     cin >> t;
  10.  
  11.     while(t--)
  12.     {
  13.         cin >> n;
  14.         arr[n]++;
  15.     }
  16.  
  17.     count = min(arr[1],arr[3]);
  18.     arr[1] = arr[1] - count;
  19.     arr[3] = arr[3] - count;
  20.     count = count + arr[4] + arr[3];
  21.     count = count + ceil((arr[1]+2*arr[2])/4.0) ;
  22.     cout<<count;
  23.     return 0;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top