Mock CCC '20 Contest 1 J2 - A Simplex Problem

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 1.0s
Memory limit: 1G

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

koosaga has been training hard for programming contests! One day, he decides to study linear programming, which invariably gets him to learn about the simplex algorithm.

Unrelated to the simplex algorithm, koosaga has discovered that there are two things which spark joy in his life - cacti and matroids. If koosaga has C cacti and M matroids, then his joy is C U_c + M U_m.

koosaga is a busy person though, so C + M cannot be too large. Fortunately, koosaga is a resourceful individual and will be able to obtain arbitrarily many cacti and matroids subject to this constraint.

koosaga wishes to know the maximum joy that can be sparked.

Constraints

K, U_c, U_m \le 100

Subtasks

In tests worth 5 marks, K = 1.

In tests worth another 5 marks, U_c and U_m are both equal to 1.

Input Specification

The first line contains a single positive integer, U_c, the amount of joy a single cactus sparks.

The second line contains a single positive integer, U_m, the amount of joy a single matroid sparks.

The third line contains a single positive integer, K. The total number of cacti and matroids that koosaga can own may not exceed K.

Output Specification

Output, on a single line, the maximum amount of joy that can be sparked.

Sample Input 1

10
10
1

Sample Output 1

10

Sample Input 2

1
1
10

Sample Output 2

10

Comments

There are no comments at the moment.