This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
using namespace std;
#define int long long
#define ff first
#define ss second
int mod = 1e9 + 7;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n , w;
cin >> w >> n;
int a[n] , b[n] , c[n];
for(int i = 0; i < n; i++){
cin >> a[i] >> b[i] >> c[i];
}
int res = 0;
for(int i = 1; i <= c[0]; i++){
if(b[0] * i > w){
break;
}
res += a[0];
}
cout << res;
return 0;
}
//AZIM_BEST
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |