SHARE
TWEET

Untitled

a guest Jan 18th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. vector<int> b = {50, 100 , 500, 1000, 5000};
  2. vector<int> F(K + 1, 1000000000);
  3. F[0] = 0;
  4. for(int i = 1; i < K + 1; ++i)
  5. {
  6.     for(int j = 0; j < b.size(); ++j)
  7.     {
  8.         if(i - b[j] >= 0 && F[i - b[j] < F[i])
  9.         {
  10.             F[i] = F[i - b[j]]
  11.         }
  12.     }
  13.     F[i]++;
  14. }
  15. cout << F[K];
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