| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1184775 | 12345678 | Roses (BOI20_roses) | C++20 | 1 ms | 400 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n, a, b, c, d, ans=1e18;
ll divide(ll x, ll y)
{
if ((x%y)==0) return x/y;
return x/y+1;
}
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n>>a>>b>>c>>d;
for (int i=0; i<=100000; i++) if (a*i<=n) ans=min(ans, b*i+divide(n-a*i, c)*d);
for (int i=0; i<=100000; i++) if (c*i<=n) ans=min(ans, d*i+divide(n-c*i, a)*b);
cout<<ans;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
