제출 #1291099

#제출 시각아이디문제언어결과실행 시간메모리
1291099lmaobruhRoses (BOI20_roses)C++20
20 / 100
7 ms580 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define eb emplace_back #define pb push_back #define fi first #define se second #define ii pair<int,int> #define ve vector #define all(x) x.begin(), x.end() #define fo(i,a,b) for (int i=(a); i<=(b); ++i) #define fd(i,a,b) for (int i=(a); i>=(b); --i) #define maxi(a, b) a = max(a, b) #define mini(a, b) a = min(a, b) #define _ << ' ' << const int N = 2e7+5, inf = 1e9+10, mod = 1e9+7; const ll inf64=4e18+1; /** **/ ll n, a, b, c, d; ll cd(ll x, ll y) { return max(0ll,(x+y-1)/y); } void sol() { cin >> n >> a >> b >> c >> d; ll ans = inf; fo(i,0,1000000) mini(ans,1ll*i*b+cd(n-1ll*i*a,c)*d); fo(i,0,1000000) mini(ans,1ll*i*d+cd(n-1ll*i*c,a)*b); cout<<ans; } signed main(){ ios::sync_with_stdio(0); cin.tie(0); if(fopen("A.inp","r")) { freopen("A.inp","r",stdin); freopen("A.out","w",stdout); } int tc = 1; // cin >> tc; fo(i,1,tc) sol(); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Roses.cpp: In function 'int main()':
Roses.cpp:41:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |         freopen("A.inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~
Roses.cpp:42:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |         freopen("A.out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...