답안 #642344

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
642344 2022-09-19T09:19:02 Z Erennedirlo Roses (BOI20_roses) C++17
0 / 100
0 ms 304 KB
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;

  double fp1=(double)A/B, fp2 = (double)C/D;


  int spent=0;

  if(fp1 > fp2){
    while(N>=A){
      spent+=B; N-=A;
    }
    if(((N-1) / C + 1) * D < ((N-1) / A + 1) * B){
      spent+=((N-1) / C + 1) * D;
    }
    else{
      spent+=((N-1) / A + 1) * B;
    }
  }

  else{
    while(N>=C){
      spent+=D; N-=C;
    }
    if(((N-1) / C + 1) * D < ((N-1) / A + 1) * B){
      spent+=((N-1) / C + 1) * D;
    }
    else{
      spent+=((N-1) / A + 1) * B;
    }

  }

  cout<<spent<<"\n";

  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Incorrect 0 ms 300 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Incorrect 0 ms 300 KB Output isn't correct
4 Halted 0 ms 0 KB -