Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <math.h>
  5.  
  6. using namespace std;
  7.  
  8. int main(){
  9.  
  10. int eggs;
  11. int n;
  12. vector<int> prices;
  13.  
  14.  
  15. cin >> eggs;
  16. cin >> n;
  17.  
  18.  
  19. for(int i=0; i < n; i++){
  20.  
  21. int temp;
  22. int tempt;
  23.  
  24. cin >> temp >> tempt;
  25.  
  26. int oneegg = tempt * eggs;
  27. int tomultiply = round(eggs / 6);
  28. int sixeggs = tomultiply * temp;
  29.  
  30. prices.push_back(sixeggs);
  31. prices.push_back(oneegg);
  32.  
  33. }
  34.  
  35. sort(prices.begin(),prices.end());
  36.  
  37. cout << prices[0] << "\n";
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement