Created
September 19, 2017 14:06
-
-
Save MatejMecka/81076b9c995ff4efbae628069f10bca3 to your computer and use it in GitHub Desktop.
Tapa sum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <math.h> | |
using namespace std; | |
int main(){ | |
int eggs; | |
int n; | |
vector<int> prices; | |
cin >> eggs; | |
cin >> n; | |
for(int i=0; i < n; i++){ | |
int temp; | |
int tempt; | |
cin >> temp >> tempt; | |
int oneegg = tempt * eggs; | |
int tomultiply = round(eggs / 6); | |
int sixeggs = tomultiply * temp; | |
prices.push_back(sixeggs); | |
prices.push_back(oneegg); | |
} | |
sort(prices.begin(),prices.end()); | |
cout << prices[0] << "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment