1 solutions

  • 0
    @ 2025-12-3 17:18:54

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int n,m,a,b,c,d;
    int main()
    {
    	cin>>n>>m>>a>>b>>c>>d;
    	if(b*m>=n) {cout<<n;return 0;}
    	else{
    		int nn=n-b*m;
    		if(c>=nn){cout<<b*m+nn*m;return 0;}
    		else {cout<<-1;return 0;}
    	}
    }
    /**
    5 10 0 1 0 0
    2 10 2 0 1 0
    51 7 7 7 7 7 
    */
    
    • 1

    Information

    ID
    984
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By