Submission #1023624

#TimeUsernameProblemLanguageResultExecution timeMemory
1023624vjudge1Knapsack (NOI18_knapsack)C++17
0 / 100
1065 ms348 KiB
#include <bits/stdc++.h> using namespace std;// Hello world arsaoshe aneru nesi isods const int mod = 1e9+7; const char nl = '\n'; typedef long long ll; const int N = 1e5 + 5 ; #define ff first #define ss second void void_code () { ll s; cin >> s ; ll n; cin >> n; ll ans = 0 ; for ( int i = 0 ;i < n; i ++ ){ ll a, b, c; cin >> a>> b >> c ; while ( s - b != 0 or c != 0 ) { s -= b; ans += a; c -- ; } } cout << ans ; } signed main() { ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); int t = 1; //test //~ cin >> t; while (t--) void_code (); 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...