1 solutions

  • 0
    @ 2023-12-13 21:13:07
    #include <iostream>
    #include <bits/stdc++.h>
    using namespace std;
    struct pencil{
    	int num;
    	int price;
    }pp[10005];
    
    int times(int x , int n){
    	int a;
    	for(int i = 1 ;;i++){
    		if(i*x >= n){
    			a = i;
    			break;
    		}
    	}
    	return (a);
    }
    
    int main()
    {
    	int n;
    	cin >> n;
    	int a,b,c;
    	for(int i = 1 ;i <= 3 ;i++){
    		cin >> pp[i].num >> pp[i].price;
        }
        a = times(pp[1].num , n) * pp[1].price;
    	b = times(pp[2].num , n) * pp[2].price;
    	c = times(pp[3].num , n) * pp[3].price;
    
    	int m[4];
    	m[1] = a;
    	m[2] = b;
    	m[3] = c;
    	sort(m + 1 , m + 4);
    	cout << m[1];
    	return 0;
    }
    
    • 1

    Information

    ID
    904
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    10
    Tags
    # Submissions
    1
    Accepted
    1
    Uploaded By