DMOPC '17 Contest 3 P0 - 2-Satisfiability

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

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

Roger is buying his friends Victor and Jacky presents! He has a budget of $B to buy the two presents with. The satisfiability is equal to the product of the amount of money spent on Victor's present multiplied by the amount of money spent on Jacky's present. What partitioning of the budget will result in the greatest satisfiability?

Hint: The satisfiability can be expressed as a function \operatorname f(x) = x(B-x). This is a quadratic curve, and has a maximum value at x = \frac B 2.


1 \le B \le 10^9

Input Specification

The input will contain a single integer, B.

Output Specification

Two space-separated numbers, the amount spent on the two presents, in any order, to two decimal places.

Sample Input 1


Sample Output 1

$2.00 $2.00

Sample Input 2


Sample Output 2

$0.50 $0.50


There are no comments at the moment.