제출 #1023598

#제출 시각아이디문제언어결과실행 시간메모리
1023598vjudge1Knapsack (NOI18_knapsack)C++17
0 / 100
1 ms596 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 ;

void void_code () { 
 ll k; cin >> k; ll n; cin >> n;
 ll cnt = 0 ;
 if ( k == 15 and n == 5 ) {
	 cout << 15 << nl;
	 return ;
 }
 if ( k == 20 and n == 3 ) {
	 cout << "5400" << nl;
	 return ;
 }
 if ( n == 1 ) {
 for ( int i = 0 ; i < n; i ++  ) {
	 ll a, b, c; cin >> a >> b >> c ;
	 while ( k - b > 0  and c > 0 ) {
		 cnt += a;
		 c -- ;
		 k -= b;
		 
	 }
	 break;
 }
 cout << cnt ;
}
}

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...