#include<bits/stdc++.h>
using namespace std;
#define int long long
#define speed cin.tie(0)->sync_with_stdio(0), cout.tie(0)
int32_t main()
{
speed;
int n, s;
cin>>s>>n;
for ( int i=0 ; i<n ; ++i ){
int v, w, k, x=0, y=0;
cin>>v>>w>>k;
while ( y<=s && k>=0 )
{
y+=w;
x+=v;
k--;
}
cout<<x-v;
}
return 0;
}
# | 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... |