Linear Congruences by murky-satyr

for(;;print(i<m?i+' + '+m+'k':'no solutions')){for(b=[j=k=n=0];_=readline().match(/\d+/g);)[it[n],b[n++]]=_
for(m=b[j];++j<n;m=w/m)for(z=b[j],w=m*z;z;)z=m%(m=z)
for(i=-1;k<n&&++i<m;)for(k=0;k<n&i%b[k]==it[k];)k++}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page