| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1362925 | shreyas_arun | Knapsack (NOI18_knapsack) | C++20 | 0 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct hw
{
ll val, w, k;
};
void solve()
{
ll s, n;
cin >> s >> n;
vector<hw> v(n);
for (auto &i : v)
{
cin >> i.val >> i.w >> i.k;
}
if (n == 1)
{
if (v[0].w > s)
{
cout << 0 << '\n';
return;
}
ll cal = s / v[0].w;
if (cal >= v[0].k)
{
cout << v[0].val * v[0].k << '\n';
}
else if (cal < v[0].k)
{
cout << v[0].val * cal << '\n';
}
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
