Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <vector>
- using namespace std;
- int main()
- {
- int m;
- int n;
- cin>>m>>n;
- int mineden=2e9;
- int minsest=2e9;
- int matrica[n][2];
- for(int i=0; i<n; i++){
- for(int j=0; j<2; j++){
- cin>>matrica[i][j];
- if(j==1){
- if(matrica[i][j]<mineden){
- mineden=matrica[i][j];
- }
- }
- if(j==0){
- if(matrica[i][j]<minsest){
- minsest=matrica[i][j];
- }
- }
- }
- }
- // cout << mineden << " " << minsest << endl;
- int minimum=2e9;
- for(int i=0; i<100; i++){
- for(int j=0; j<100; j++){
- if(i+j*6>=m){
- if(i*mineden+j*minsest<minimum){
- minimum=i*mineden+j*minsest;
- }
- }
- }
- }
- cout<<minimum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement