Submission #1023587

#TimeUsernameProblemLanguageResultExecution timeMemory
1023587vjudge1Knapsack (NOI18_knapsack)C++17
12 / 100
1 ms348 KiB
#include "bits/stdc++.h" #define int long long using namespace std; const int mod = 1000000007; signed main() { ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); int n,s; cin>>s>>n; int sum=0; int vec=0; while(n--){ int a,b,c; cin>>b>>a>>c; int o=0; while(vec+a<=s){ vec+=a; sum+=b; o++; if(o==c){ break; } } cout<<sum; return 0; } // int t; // cin>>t; // while(t--){ // int n, m; cin >> n >> m; //// f.resize(n + 1), inv.resize(n + 1); //// //// f[0] = inv[0] = 1; //// for(int i=1;i<=n;i++){ //// f[i] = f[i - 1] * 1ll * i % mod; //// //// inv[i] = binary_power(f[i], mod - 2, mod); //// } // // cout<<bin(n,m)<<"\n"; //} 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...