Zngu Ubzrjbex

Time: 15.0 s     Memory: 1024 MB
  • Input

    Input consists of one line with the four integers $a$, $b$, $c$ and $s$. It holds that $1 \leq a,b,c \leq 50$ and $0 \leq s \leq 80$.

    Output

    Print all solutions to $a \cdot x + b \cdot y + c \cdot z = s$ on separate lines, in the format x y z. The solutions should be sorted in lexographical order, first by $x$, then by $y$ (if $x$ values are equal) and finally by $z$ (if $x$ and $y$ values are equal). If there are no solutions, output impossible on a single line.

    Sample Input 1 Sample Output 1
    2 4 4 14
    
    1 0 3
    1 1 2
    1 2 1
    1 3 0
    3 0 2
    3 1 1
    3 2 0
    5 0 1
    5 1 0
    7 0 0
    
    Sample Input 2 Sample Output 2
    10 8 6 24
    
    0 0 4
    0 3 0
    1 1 1
    
    Sample Input 3 Sample Output 3
    2 4 6 9
    
    impossible
    
Chalmers golftävling 2023
  •  
  • To solve the problems, you can either start a virtual contest or register for regular practice. A virtual contest simulates a participation in the original contest with a duration of 1 day, while regular practice lets you submit solutions without any constraints.

    You must log in to register.
  • A Zngu Ubzrjbex
You must log in to submit solutions to the problem.
{"contest_start_timestamp": 1680300000, "contest_duration": 86400, "contest_started": true, "contest_ended": true, "flexible_start_window_end_time": null, "only_virtual": false}