제출 #1305692

#제출 시각아이디문제언어결과실행 시간메모리
1305692athenaKnapsack (NOI18_knapsack)C++20
0 / 100
1 ms976 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
    int s,n;
    cin>>s>>n;
    int cost=0;
    int sum=0;
    while(n--)
    {
        int x,y,z;
        cin>>x>>y>>z;
        while(z!=0 && sum<s)
        {
            cost+=x;
            sum+=y;
            z--;
        }
    }
    cout<<cost<<endl;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...