답안 #546698

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
546698 2022-04-08T07:51:23 Z srivatsav_kannan Roses (BOI20_roses) C++14
0 / 100
1 ms 256 KB
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#include <numeric>
#include <stack>
#include <cstring>
#include <bitset>
#include <climits>
#include <valarray>
#include <list>
#define int long long
#define inf 1000000000
#define endl '\n'
#define mod 1000000007
using namespace std;
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,a,b,c,d; cin >> n >> a >> b >> c >> d;
    if (a*b > c*d){
        swap(a, c);
        swap(b, d);
    }
    int mn = inf;
    for (int i = 0; i < c; i++){
        int sec = n - (i*a);
        int fir = 0;
        if (sec > 0){
            fir = (sec-1)/c+1;
        }
        mn = min(mn, (fir*d)+(i*b));
    }
    cout << mn << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -