fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, a, b, c, d, e;
  6. cin >> n >> a >> b >> c >> d >> e;
  7. int t = 2*a;
  8. if (n >= 2 * c) {
  9. t= min(t, 2*b);
  10. }
  11. if (n >= 2 * e) {
  12. t= min(t, 2*d);
  13. }
  14. if(n>= c+e) {
  15. t=min(t, b+d);
  16. }
  17. cout << t << endl;
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.01s 5304KB
stdin
10 30 20 3 10 6
stdout
30