fork download
  1. $3{for(y=$1;($1<x=(y*$2+1)/$3)+x%1;y--);}$0=x" "y
Success #stdin #stdout 0s 5304KB
stdin
5
1 1 1
5 2 5
5 3 2
5 0 1
50 48 49
stdout
 
1 0
1 2
5 3
1 5
49 50