Advertisement
karupayun

tap17/l.cpp

Oct 22nd, 2017
173
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <cassert>
  4. using namespace std;
  5. int l,o,s,t,m, rta;
  6.  
  7. void f (int a, int b, int c, int d){
  8.     m = 1e9;
  9.     if (a) m = min (m, l/a);
  10.     if (b) m = min (m, o/b);
  11.     if (c) m = min (m, s/c);
  12.     if (d) m = min (m, t/d);
  13.     l-= a*m; o-= b*m; s-= c*m; t-= d*m;
  14.     rta += m;  
  15. }
  16.  
  17. int main(){
  18.     cin >> l >> o >> s >> t;
  19.     rta = 0;
  20.     f(0,4,0,0); // oooo
  21.     f(2,2,0,0); // lloo
  22.     f(0,0,0,4); // tttt
  23.     f(1,0,1,2); // lstt
  24.     f(2,0,2,0); // llss
  25.     f(4,0,0,0); // llll
  26.     cout << rta << endl;
  27.  
  28.     return 0;  
  29. }
Advertisement
RAW Paste Data Copied
Advertisement