제출 #1184526

#제출 시각아이디문제언어결과실행 시간메모리
118452612345678Roses (BOI20_roses)C++20
0 / 100
0 ms332 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll n, a, b, c, d, res, 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; ll cnt=n/(a*c); n-=cnt*(a*c); res=min(b*c, a*d)*cnt; for (int i=0; i*a<=n; i++) ans=min(ans, res+b*i+d*divide(n-i*a, c)); cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...