Advertisement
iskhakovt

Untitled

Feb 20th, 2015
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8.     double answer = 1000000, min_first_part, curr;
  9.     queue<double> waiting;
  10.  
  11.     cin >> min_first_part;
  12.     for (int i = 0; i != 5; ++i) {
  13.         cin >> curr;
  14.         waiting.push(curr);
  15.     }
  16.  
  17.     while (cin >> curr) {
  18.         answer = min(answer, min_first_part * curr);
  19.         min_first_part = min(min_first_part, waiting.front());
  20.         waiting.pop();
  21.         waiting.push(curr);
  22.     }
  23.  
  24.     cout << answer << '\n';
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement