The user input consists of six positive integers \(m\), \(n\), \(a\), \(b\), \(c\), and \(d\). Determine the smallest non-negative integer \(x\) such that \[ax+b\] gives the remainder \(c\) when divided by \(m\) while for this same \(x\) the number \(ax+b\) gives the remainder \(d\) when divided by \(n\). If such an integer \(x\) does not exist, display the message There is no such x
.
Your code should replace the text // ??? //
below
#include<iostream> int main(){ int m,n,a,b,c,d; std::cin >> m >> n >> a >> b >> c >> d; // ??? // return 0; }\begin{eqnarray*} \begin{array}{|c|l|l|}\hline \mbox{Test case}&\mbox{Input}&\mbox{Output}\\ \hline 1& 17 \quad 19 \quad 5 \quad 3 \quad 2 \quad 6 & 316 \\ \hline 2& 18 \quad 19 \quad 2 \quad 8 \quad 1 \quad 5 &\mbox{There is no such x}\\ \hline \end{array} \end{eqnarray*}